zoukankan      html  css  js  c++  java
  • 选项框

    一、代码如下

    package www.tainiu.gui;
    
    import java.awt.GridLayout;
    
    import javax.swing.ButtonGroup;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    
    public class ac__XuanXiangKuang__V1 extends JFrame {
    	JPanel jp1,jp2,jp3;
    	JLabel jl1,jl2;
    	JButton jb1,jb2;
    	JCheckBox jcb1,jcb2,jcb3;
    	JRadioButton jrb1,jrb2;
    	ButtonGroup by;
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		ac__XuanXiangKuang__V1 xv= new ac__XuanXiangKuang__V1();
    
    	}
    	
    	public ac__XuanXiangKuang__V1() {
    		// TODO Auto-generated constructor stub
    		//创建组件
    		this.jp1= new JPanel();
    		this.jp2= new JPanel();
    		this.jp3= new JPanel();
    		this.jl1= new JLabel("你喜欢的运动");
    		this.jl2= new JLabel("你的性别");
    		this.jb1= new JButton("注册用户");
    		this.jb2= new JButton("取消注册");
    		this.jcb1= new JCheckBox("足球");
    		this.jcb2= new JCheckBox("篮球");
    		this.jcb3= new JCheckBox("网球");
    		
    		this.jrb1= new JRadioButton("男");
    		this.jrb2= new JRadioButton("女");
    		ButtonGroup bg= new ButtonGroup();
    		bg.add(jb1);
    		bg.add(jb1);
    		
    		//设置管理器
    		this.setLayout(new GridLayout(3, 1));
    		//添加组件
    		this.jp1.add(this.jl1);
    		this.jp1.add(this.jcb1);
    		this.jp1.add(this.jcb2);
    		this.jp1.add(this.jcb3);
    		
    		this.jp2.add(this.jl2);
    		this.jp2.add(this.jrb1);
    		this.jp2.add(this.jrb2);
    		
    		this.jp3.add(jb1);
    		this.jp3.add(jb2);
    		
    		
    		this.add(this.jp1);
    		this.add(this.jp2);
    		this.add(this.jp3);
    		
    		//设置容器属性
    		this.setSize(300, 150);
    		this.setLocation(200, 200);
    		//this.setResizable(false);
    		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    		this.setVisible(true);
    		
    	}
    	
    	
    
    }
    
  • 相关阅读:
    第72天: PySpider框架的使用
    第71天: Python Scrapy 项目实战
    Web前端资源汇总
    1201即将到来
    C#自定义事件模拟风吹草摇摆
    HTML5 Canvas爱心时钟代码
    CSS3圆环动态弹出菜单
    CSS3实现Loading动画特效
    HTML5优势
    CSS3扁平化Loading动画特效
  • 原文地址:https://www.cnblogs.com/wujianbo123/p/7553706.html
Copyright © 2011-2022 走看看