How could I create a timer that is compatible in a JFrane
/JPanel
oriented program where it just waits 1 second, and then continues on with the rest of the code?
I do not want to use Thread.sleep();
since it is causing problems for me.
How could I create a timer that is compatible in a JFrane
/JPanel
oriented program where it just waits 1 second, and then continues on with the rest of the code?
I do not want to use Thread.sleep();
since it is causing problems for me.
For this kind of tasks you can use javax.swing.Timer. It integrates with the Event Dispatching Thread (EDT).
TimeUnit.SECONDS.sleep(1)
More helpful information here: How to delay in Java?