降低至零我有一個毫秒,我將它轉換爲hh:mm:ss的現在我想讓它自動降低值加班..像倒計時JAVA製作時間擺動計時器
例如,當用戶看到它,2:11 0 - > 2:10 59 - > 58 2:10 ...
下面是我的代碼..
Timer t = new Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
int s = ((TIMER/1000) % 60);
int m = (((TIMER/1000)/60) % 60);
int h = ((((TIMER/1000)/60) /60) % 60);
timing.setText(hour + " hours, " + min + " minutes" + sec + " seconds");
timing.repaint();
}
}
t.start();
這可能嗎?
我該怎麼做?我是新來的java – SOer 2010-11-30 14:37:13
假設TIMER是一個數字類型,TIMER - = 1000;應該這樣做。 http://download.oracle.com/javase/tutorial/java/nutsandbolts/op1.html下面是Java的各種定時器的更多參考資料:http://java.sun.com/products/jfc/tsc/articles/timer /和http://download.oracle.com/javase/tutorial/uiswing/misc/timer.html – Tansir1 2010-11-30 14:44:33