package iih.ci.test;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
class MyFrame extends JFrame{
private JCheckBox chkMusic;
private JCheckBox chkSports;
private JCheckBox chRead;
private JCheckBox chkTravel;
private JLabel lab;
MyFrame (String s){
super(s);
setSize(400,200);
setLocationRelativeTo(null);
JPanel jpan=new JPanel();
setContentPane(jpan);
lab = new JLabel("爱好:");
chkMusic =new JCheckBox("音乐:");
JCheckBox chkRead = new JCheckBox("阅读:");
chkSports =new JCheckBox("体育:");
chkTravel =new JCheckBox("旅游");
jpan.add(lab);
jpan.add(chkMusic);
jpan.add(chkRead);
jpan.add(chkSports);
jpan.add(chkTravel);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
public static void main( String [] args) {
MyFrame frm =new MyFrame("框架");
}
}
|