Tag:public user name frame null import
import javax.swing.*;/** * created by administrator on 2015/4/13 0013. * <p> * absolute positioning of components : using Compontent The setbounds method in the class * <p> * <p> * setbounds x y represents the position of the component width height the height of the component */public class Chap15_10 { public static void main (String[] args) { jframe frame = new jframe ("Landing window"); frame.setlayout (NULL); jlabel lblogin = new jlabel ("User name"); Jtextfield textlogin = new jtextfield (); jlabel lbpassword = New jlabel ("password"); jtextfield textpassword = new jtextfield (); jbutton btncon = New jbutton ("Connection"); jbutton btnexit = new jbutton ("Exit"); jbutton btnpro = new JButton ("attribute"); //container size position definition frame.setsize (400, 200); frame.setlocation (300 , 200); //user name and input box positioning lblogin.setbounds (45,5,50,20); textlogin.setbounds (100, 5, 210, 20); Lbpassword.setbounds (45, 35,&NBSP;50,&NBSP;20); textpassword.setbounds (100, 35, &NBSP;210,&NBSP;20); btncon.setbounds (45, 100, 80, &NBSP;20); btnexit.setbounds (130,&NBSP;100,&NBSP;80,&NBSP;20); btnpro.setbounds (220, 100, 80, 20); frame.add (Lblogin); Frame.add (Textlogin); frame.add (LbPassword); frame.add (Textpassword); Frame.add (Btncon); frame.add (Btnexit); frame.add (Btnpro); frame.setvisible ( true); }}
The implementation is:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6B/5F/wKiom1UryMbzHoAuAACGOOjBy84302.jpg "title=" capture. PNG "alt=" Wkiom1urymbzhoauaacgoojby84302.jpg "/>
This article is from the "Monkey Moving Brick" blog, please be sure to keep this source http://silianbo.blog.51cto.com/6627757/1632018
Implementation of the Java Landing window