Import Java.awt.gridlayout;import Java.io.bufferedreader;import Java.io.ioexception;import Java.io.inputstreamreader;import Javax.swing.jbutton;import Javax.swing.jframe;import Javax.swing.JLabel;import Javax.swing.jpanel;import javax.swing.jpasswordfield;import javax.swing.jtextfield;class Jiem extends JFrame{ JTextField JTextField;//define text box component JPasswordField jpasswordfield;//define cipher box component JLabel Jlabel1,jlabel2; JPanel jp1,jp2,jp3; Public Jiem () {JButton jbu1,jbu2; JTextField = new JTextField (12); JPasswordField = new JPasswordField (13); JLabel1 = new JLabel ("User name"); JLabel2 = new JLabel ("password"); JBU1 = new JButton ("confirmation"); JBU2 = new JButton ("Cancel"); JP1 = new JPanel (); JP2 = new JPanel (); JP3 = new JPanel (); Set Layout this.setlayout (new GridLayout (3,1)); Jp1.add (JLABEL1); Jp1.add (JTextField);//First panel add user name and text box Jp2.add (JLABEL2); Jp2.adD (JPasswordField);//The second panel adds a password and password input box Jp3.add (JBU1); Jp3.add (JBU2); The third panel adds confirmation and cancellation//Jp3.setlayout (New FlowLayout ()); Because JPanel default layout is FlowLayout, you can unregister this code. This.add (JP1); This.add (JP2); This.add (JP3); Add three panels to the login box//settings display This.setsize (300, 200); This.pack (); This.setdefaultcloseoperation (Jframe.exit_on_close); This.setvisible (TRUE); This.settitle ("Landing"); Public login () {String name= "abc"; int mima=123; }}
Interface, failed product