定时器Timer基本使用

Timer timer =new Timer(t,testTimer);
timer.start();

t是以毫秒为单位的时间,
testTimer是实现了ActionListener接口类的对象,其需要实现或者重写actionPerformed方法,也就是定时器不断重复调用的程序

timer.start()是开始执行上面的actionPerformed的程序

posted @ 2023-04-09 17:09  Geek李  阅读(82)  评论(0)    收藏  举报