Java Sun Existing two sets of GUI class library:
The original AWT (which is built on the platform's local graphics system, is not perfect across the platform) and a new GUI called Java base class (JFC) or swing (flexible cross-platform use);
Create a gui:1 selection container; 2 set layout mode; 3 Add components.
JPanel class: Also a container it differs from the JFrame class container in that it lacks jframe headings and borders;
JTextField class: A component that contains a single line of text data items;
Jradiobutton class: For radio buttons, this class instance generates actions and project events;
JComboBox class: For combo boxes, contains a drop-down list;
BorderLayout class: Layout management uses, from left to right, from top to bottom of the way to place parts.
Second, Java GUI panel settings, the use of methods and panel steps:
Import javax.swing.*
Import java.awt.*
Import java.awt.event.*
public class hehe {
JButton JB Utton1,jbutton2;
JLabel Jlabel1,jlabel2;
//Panel panel1,panel2,panel3;
Public JPanel hehe1 () {
JPanel panel1=new JPanel ();
Jlabel1=new JLabel ("No one can replace you!", Jlabel.center);
Panel1.add (JLABEL1);
return Panel1;
}
Public JPanel hehe2 () {
JPanel panel2=new JPanel ();
Jlabel2=new JLabel ("I love you!", Jlabel.center);
Panel2.add (JLABEL2);
return Panel2;
}
Public JPanel hehe3 () {
JPanel panel3=new JPanel ();
Jbutton1=new JButton ("OK?");
Jbutton2=new JButton ("Love Me!");
Panel3.add (JButton1);
Panel3.add (JButton2);
return Panel3;
}
public static void Main (string[] args) {
JFrame frame=new JFrame ("Dsfnkjlsdfoi");
Hehe yang=new hehe ();
JPanel panel1=yang.hehe1 ();
JPanel panel2=yang.hehe2 ();
JPanel Panel3=yang.hehe3 ();
Frame.add (Panel1,borderlayout.north);
Frame.add (Panel2,borderlayout.center);
Frame.add (Panel3,borderlayout.south);
Frame.setdefaultcloseoperation (jframe.exit_on_close);
Frame.setsize (300,250);
Frame.setvisible (TRUE);
}
}