码迷,mamicode.com
首页 > 其他好文 > 详细

综合运用开关按钮JToggleButton、复选框JCheckBox、单选框JRadioButton和按钮ButtonGroup,设计如下界面

时间:2017-09-16 00:38:23      阅读:203      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!