[Java] view plaincopy
/*
Time:
2012-10-18
Author:
Smoke
Program Design:
Implement a program output window
Program explanation:
This program is mainly used for setting familiar layout,
Familiarize yourself with the usage and features of some la s through this program
*/
Import javax. swing .*;
Import java. awt .*;
Class Day1018_Frame
{
Public static void main (String [] args)
{
JFrame f = new JFrame ("My window program! ");
Container c = f. getContentPane ();
// FlowLayout l = new FlowLayout ();
// BorderLayout l = new BorderLayout ();
// GridLayout l = new GridLayout (7,1 );
GridBagLayout l = new GridBagLayout ();
C. setLayout (l );
C. add (new JLabel ("Please select your answer :"));
C. add (new JCheckBox ("A: Getting Russian mage "));
C. add (new JCheckBox ("B: good places around the Internet "));
C. add (new JCheckBox ("C: when delivery is received "));
C. add (new JCheckBox ("D: The location is not "));
String str [] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday "};
JComboBox B = new JComboBox (str );
C. add (B );
String str2 [] = {"Mathematics", "Chinese", "English", "physics", "chemistry "};
JList ls = new JList (str2 );
C. add (ls );
F. setdefaclocloseoperation (JFrame. EXIT_ON_CLOSE );
F. setVisible (true );
// F. setSize (400,300 );
F. pack ();
}
}