标签:dem 开关 管理人 radio 应用 imp splay ane 按钮
import java.awt.*;
import java.awt.event.*;
import javax.util.*;
public class ButtonGroupDemo{
private JFname f=new JFname("按钮综合应用");
private JPanel pc=new JPanel(new GridLayout(1,3));
private JPanel p1=new JPanel(new GridLayout(4,1,0,20));
private JPanel p2=new JPanel(new GridLayout(3,1,0,30));
private JPanel p3=new JPanel(new GridLayout(6,1,0,5));
private JPanel pb=new JPanel(new GridLayout(1,2,10,5));
private JLabel display=new JLebel();
Font ft=new Font("Serif",Font.BOLD,18);
ButtonGroup bg1=new ButtonGroup();
ButtonGroup bg2=new ButtonGroup();
JRadioButton cb1=new JRadioButton("学生");
JRadioButton cb2=new JRadioButton("教师");
JRadioButton cb3=new JRadioButton("管理人员");
JRadioButton cb4=new JRadioButton("男");
JRadioButton cb5=new JRadioButton("女");
JCheckBox cb6=new JCheckBox("旅游");
JCheckBox cb7=new JCheckBox("看书");
JCheckBox cb8=new JCheckBox("上网");
JCheckBox cb9=new JCheckBox("运动");
JCheckBox cb10=new JCheckBox("交友");
}
综合运用开关按钮JToggleButton、复选框JCheckBox、单选框JRadioButton和按钮ButtonGroup,设计如下界面
标签:dem 开关 管理人 radio 应用 imp splay ane 按钮
原文地址:http://www.cnblogs.com/liao-pxsoftware15/p/7529194.html