zoukankan      html  css  js  c++  java
  • 自考 exec 7 3

    import javax.swing.*;
    
    import java.awt.FlowLayout;
    import java.awt.event.*;
    public class Exec73 extends JFrame implements ActionListener{
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            new Exec73();
    
        }
        Exec73(){
            this.setTitle("Exec73 Test");
            this.setSize(400,400);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setLocationRelativeTo(null);
            
            jrb1 = new JRadioButton("Foot Ball");
            jrb2 = new JRadioButton("Basket Ball");
            jrb3 = new JRadioButton("Swim");
            text = new JTextField(10);
            
            jrb1.addActionListener(this);
            jrb2.addActionListener(this);
            jrb3.addActionListener(this);
            
            this.setLayout(new FlowLayout());
            
            ButtonGroup g = new ButtonGroup();
            g.add(jrb1);g.add(jrb2);g.add(jrb3);
            
            add(jrb1);
            add(jrb2);
            add(jrb3);
            add(text);
            
            setVisible(true);
            pack();
            
            
        }
        public void actionPerformed(ActionEvent e) {
            JRadioButton tjrb = (JRadioButton)e.getSource();
            text.setText(tjrb.getActionCommand());
        }
        JRadioButton jrb1,jrb2,jrb3;
        JTextField text;
    }
  • 相关阅读:
    JQuery DOM操作
    JQuery 选择器和事件
    LinQ 组合查分页
    LinQ
    web 图片验证码 验证
    Web 上传图片加水印
    Web 组合查询加 分页
    ajax连接数据库加载+三级联动
    jq动画
    jq基础
  • 原文地址:https://www.cnblogs.com/qqjue/p/2627327.html
Copyright © 2011-2022 走看看