import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
/*
时 代 J a v a
*/
import javax.swing.Timer;
public class TickTock {
public static void main(String[] args) {
Timer t = new Timer(1000, new Ticker());
t.start();
// display a message box to prevent the program from ending immediately
JOptionPane.showMessageDialog(null, "Click OK to exit program");
}/*来 自 时 代 Java - nowjava.com*/
}
class Ticker implements ActionListener {
private boolean tick = true;
public void actionPerformed(ActionEvent event) {
if (tick) {
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。