📄 checkboxcgroup.java
字号:
/*
* @(#)CheckBoxcGroup.java 1.0 05/11/17
*
* You can modify the template of this file in the
* directory ..\JCreator\Templates\Template_1\Project_Name.java
*
* You can also create your own project template by making a new
* folder in the directory ..\JCreator\Template\. Use the other
* templates as examples.
*
*/
package myprojects.checkboxcgroup;
import java.awt.*;
import java.awt.event.*;
class CheckBoxcGroup extends Frame {
public CheckBoxcGroup() {
setLayout(new FlowLayout());
String University[]={"Tsinghua","Pecking","Fudan","Nanki","Tianjin"};
CheckboxGroup cbg=new CheckboxGroup();
//public void init(){
add(new Label("Please choose the University:"));
for(int i=0;i<5;i++)
{
add(new Checkbox(University[i],cbg,false));
}
add(new Label("There are 5 University!"));
//}
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0);
}
});
}
public static void main(String args[]) {
System.out.println("Starting CheckBoxcGroup...");
CheckBoxcGroup mainFrame = new CheckBoxcGroup();
mainFrame.setSize(400, 400);
mainFrame.setTitle("CheckBoxGroup");
mainFrame.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -