import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.lang.*;public class Dazi1 extends KeyAdapter {
    static int j = (int) (Math.random() * 1000) % 26;
    static JFrame f = new JFrame("Heart欢迎您进入打字练习板块:");
    static String str[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
            "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W",
            "X", "Y", "Z" };
    static JButton b[] = new JButton[str.length];    public Dazi1() {        f.setSize(600, 600);
        f.setLocation(50, 50);
        f.getContentPane().setLayout(new GridLayout(6, 6));
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        initButtons();
    }
    public void initButtons(){
        for (int i = 0; i < 26; i++) {
            b[i] = new JButton(str[i]);
            f.getContentPane().add(b[i]);   
        }        
        j = (int) (Math.random() * 1000) % 26;
        f.setVisible(true); 
        b[j].setBackground(new Color(255,0,255));
        b[j].addKeyListener(this);
        b[j].requestFocus();
    }    public void loop() { 
        for (int i = 0; i < 26; i++) {
            b[i].setVisible(true);
        }
        
        System.out.println(str[j]);
        b[j].setBackground(new Color(255,0,255)); // 增加一个颜色
        b[j].addKeyListener(this);
        b[j].requestFocus();
    }    public void keyPressed(KeyEvent e) {        if (e.getKeyCode() == j + 65) {
            b[j].setVisible(false);
            b[j].setBackground(null); // 恢复原始颜色
            System.out.println("Right!");
            j = (int) (Math.random() * 1000) % 26;
            loop();
        } else
            System.out.println("Error!");
    }    public static void main(String[] args) {
        Dazi1 d = new Dazi1();
        
    }
}
想在程序运行三分钟的时候 ,显示正确击键多少此,没有学过线程,timer之类的,请问应该怎么办啊?
是不是要用线程之类的啊?给谢谢代码,我下来研究研究