What you want.

Source: Internet
Author: User

Importjavax.swing.*;Importjava.awt.*;//Import the necessary packages Public classDengluextendsjframe{JTextField JTextField;//Defining a text box componentJPasswordField JPasswordField;//Define a Password box componentJLabel Jlabel1,jlabel2;    JPanel jp1,jp2,jp3; JButton jb1,jb2; //Create button     PublicDenglu () {JTextField=NewJTextField (12); JPasswordField=NewJPasswordField (13); JLabel1=NewJLabel ("User name"); JLabel2=NewJLabel ("Password"); JB1=NewJButton ("Confirm"); JB2=NewJButton ("Cancel"); JP1=NewJPanel (); JP2=NewJPanel (); JP3=NewJPanel (); //Set Layout         This. setlayout (NewGridLayout (3,1));         Jp1.add (JLABEL1); Jp1.add (JTextField);//First Panel add user name and text boxJp2.add (JLABEL2); Jp2.add (JPasswordField);//Second Panel add password and password input boxJp3.add (JB1); Jp3.add (JB2); //Third Panel add 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 landing box//Set Display         This. setSize (300, 200); //This.pack ();         This. Setdefaultcloseoperation (Jframe.exit_on_close);  This. setvisible (true);  This. Settitle ("Login"); }     Public Static voidMain (string[] args) {NewDenglu (); }}

What you want.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.