-1
public void executeRepeat(String s) {
    this.move = s;
    storeValue = move;
    i = Integer.parseInt(move);
    timer = new Timer(1000, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            i--;
            if(i <= 0) {
                move = "" + i;
                if (move.trim().equals("0")) {
                    Thread th = new Thread(new DetectImage());
                    th.start();
                }
                timer.stop();
            }
            jTextField1.setText("" + i);
        }
    });
    timer.start();          
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    move = jTextField1.getText();      
    executeRepeat(move);
}

public static int stay = 0;

class DetectImage implements Runnable {
    @Override
    public void run() {
        while (stay < 3) {
            try {
                stay++;
                // few steps for comparison  
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
                Logger.getLogger(TrafficMainGUI.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        if (stay >= 3) {
            stay = 0;
            String store = storeValue;
            TrafficMainGUI traffic = new TrafficMainGUI(store);
            traffic.setVisible(true);
        }
    }
}

我正在TrafficMainGUI从这个线程调用类。整个过程进展顺利。但是我打开了多个框架。我想要处理以前的帧。我应该如何在这里实现这一点,因为我无法访问线程类中的主要方法来处理。

4

1 回答 1

0
Frame[] frames = Frame.getFrames();  

它将为您提供应用程序中的总帧数

于 2013-03-18T10:19:12.123 回答