Java GUI 定时刷新

于 2019-06-13 发布

用到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();

目录