利用Java Swing技术设计一个鼠标点击速度比赛游戏程序。程序显示一个按钮和一个文本框,用户点击按钮,文本框显示鼠标点击次数。

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class Test {
    public static void main(String[] args) {
        new MyFrame("点击测试");
    }
}
@SuppressWarnings("serial")
class MyFrame extends JFrame implements ActionListener{
    JButton button=new JButton("点击我");
    JTextField text=new JTextField("按钮点击了24次");
    int count=24;
public MyFrame(String title) {
        setTitle(title);
        setLayout(new FlowLayout());
        button.addActionListener(this);
        add(button);
        add(text);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100,100,200,200);
        pack();
}
    @Override
    public void actionPerformed(ActionEvent e) {
        count++;
        text.setText("按钮点击了"+count+"次");
    }

}


利用Java Swing技术设计一个鼠标点击速度比赛游戏程序。程序显示一个按钮和一个文本框,用户点击按钮,文本框显示鼠标点击次数。