Java language Landing Interface (Novice version)

Source: Internet
Author: User

The latest Java primer is "Head first", a great Java book.

Teacher requirements of the program flowchart I did not, before our practice is to write the code and then draw the flowchart, I think this is wrong, the flowchart should be in writing code before the design of a reflection of the idea, many of our classmates have this as a burden, anxious to write code, feel that the implementation of a function after the job is completed, There's a flowchart at the time of submission, OK, draw it. This is a common way of thinking, and I can't think of what kind of system is behind this way of thinking.

The book "Head First" tells us to check the API, but I'm not a smart student, and I still have some time to read the API.

Here is my program and the source code.

Click to replace is achievable.

Here is the source code, I feel very messy, there is no comment, and did not comment before the blog, I think I should cultivate these good habits in the future.

Import javax.swing.*;

Import java.awt.*;

Import java.awt.event.ActionEvent;

Import Java.awt.event.ActionListener;

public class Login01 {

Private JFrame frame;

Private JButton Button1,button2,button3;

private int []a=new int[6];

Private String B;//,name,keyword,checkid;

public static void Main (string[] args)

{

Login01 login=new Login01 ();

Login.go ();

}

public void Go ()

{

Frame=new JFrame ();

Frame.setdefaultcloseoperation (Jframe.exit_on_close);

JPanel panel1=new JPanel ();//account number, verification code

JPanel panel11=new JPanel ();//Account number

JPanel panel12=new JPanel ();//password

JPanel panel13=new JPanel ();//Verification Code

JPanel panel2=new JPanel ();

JPanel panel3=new JPanel ();

JLabel lable0=new JLabel ("Shijiazhuang Railway University Library Management System ");

Font bigfont =new font ("serif", font.bold,28);

Lable0.setfont (Bigfont);

Create_b ();

Button1=new JButton (b + "Click to replace ");

Button1.addactionlistener (New Blistener ());

Button2=new JButton ("Landing ");

Button2.addactionlistener (New Loginlistener ());

Button3=new JButton ("Registration ");

Button3.addactionlistener (New Registelistener ());

JTextField field1=new JTextField (10);

JTextField field2=new JTextField (10);

JTextField field3=new JTextField (10);

/*name=field1.gettext ();

Keyword=field2.gettext ();

Checkid=field3.gettext (); */

System.out.println (Name+keyword+checkid);

Panel3.setbackground (Color.White);

Panel2.setbackground (Color.White);

System.out.print (b);

Panel2.add (LABLE0);

Panel11.add (New JLabel ("Account number:"));

Panel11.add (field1);

Panel12.add (New JLabel ("Password:"));

Panel12.add (Field2);

Panel13.add (New JLabel ("Verification Code:"));

Panel13.add (field3);

Panel1.add (PANEL11);

Panel1.add (PANEL12);

Panel1.add (PANEL13);

Panel13.add (button1);

Panel1.setlayout (New BoxLayout (Panel1,boxlayout.y_axis));

Panel3.add (button2);

Panel3.add (Button3);

Frame.getcontentpane (). Add (Borderlayout.north, Panel2);

Frame.getcontentpane (). Add (Borderlayout.center, Panel1);

Frame.getcontentpane (). Add (Borderlayout.south, PANEL3);

Frame.setsize (600,400);

Frame.setvisible (TRUE);

}

Class Blistener implements actionlistener{

public void actionperformed (ActionEvent e)

{

Create_b ();

Button1.settext (b + "Click to replace ");

Frame.repaint ();

}

}

Class Loginlistener implements actionlistener{

public void actionperformed (ActionEvent e)

{

Pending completion

}

}

Class Registelistener implements actionlistener{

public void actionperformed (ActionEvent e)

{

Pending completion

}

}

public void Create_b ()

{

B= "";

for (int i=0;i<6;i++)

{

a[i]= (int) (Math.random () *10);

B+=a[i];

}

}

/*public void Ifright (String theenter)

{

if (!theenter.equals (b))

{

Pending completion

}

}*/

}

Java language Landing Interface (Novice version)

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.