Java Timer Error -
i have been learning java timers, have been having problem using them.
before begin dive deeper learning gui programming, understand java timers, being important are.
far have 2 separate classes, listener class , main class.
main class error in eclipse.
package timtest; import java.util.timer; public class timertest { public static void main(string[] args) { timlist listener = new timlist(); timer timer; timer = new timer(2000, listener ); timer.start() } }
and here listener class:
package timtest; import java.awt.event.actionevent; import java.awt.event.actionlistener; public class timlist implements actionlistener{ public void actionperformed(actionevent evt) { system.out.println("timer-test"); } }
so question is, doing wrong?
far can see done correctly.
yeah , need end line
timer.start()
with semi-colon ,then changes -->
timer.start();
Comments
Post a Comment