用到Timer。Java - How to update a panel every second
1
2
3
4
5
6
7
8
Timer timer = new Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
l.setText(new Date().toString());
}
});
timer.start();
用到Timer。Java - How to update a panel every second
1
2
3
4
5
6
7
8
Timer timer = new Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
l.setText(new Date().toString());
}
});
timer.start();