New course! Every coder should learn Generative AI!
Try a free lesson0
How to Create an TimerEvent in Java
Advanced ThankYou For Answers :)
2 Answers
+ 4
Adding up to Pedro H.J reply,
just in case you don't want to use Swing...
Pro: Runs in a dedicated background thread, the swing timer runs in the gui thread, you need to switch context to not block your gui ;)
https://www.baeldung.com/java-timer-and-timertask