综合运用开关按钮JToggleButton复选框JCheckBox单选框JRadioButton和按钮ButtonGroup,设计如下界面
Posted A Free Raindrop
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了综合运用开关按钮JToggleButton复选框JCheckBox单选框JRadioButton和按钮ButtonGroup,设计如下界面相关的知识,希望对你有一定的参考价值。
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,设计如下界面的主要内容,如果未能解决你的问题,请参考以下文章
QT5 OpenGL (六, 键盘事件, 开关灯,放大缩小综合运用)