Skip to content
Advertisement

Tag: timer

Run a java function after a specific number of seconds

I have a specific function that I want to be executed after 5 seconds. How can I do that in Java? I found javax.swing.timer, but I can’t really understand how to use it. It looks like I’m looking for something way simpler then this class provides. Please add a simple usage example. Answer EDIT: javadoc says: After the last live

Java Timer

I’m trying to use a timer to schedule a recurring event in an application. However, I want to be able to adjust the period at which the event fires in real time (according to the users input). For example: I then start a new instance of this class and call its set period function. However, when I do that, I

Advertisement