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;
    }
  • 相关阅读:
    Centos 配置网易YUM源
    JDK 变量配置
    redis如何解决key冲突?
    大数据技术(1)流式计算与Storm
    20151211小问题
    返回顶部
    20151210小问题2
    20151210小问题
    20151209小问题
    前端程序员的自我修养
  • 原文地址:https://www.cnblogs.com/qqjue/p/2627327.html
Copyright © 2011-2022 走看看