I have been trying to delay a simple piece of code in Java for a while, unfortunately if use a thread then the following code will not work as it is apart of the thread and i get lots of exceptions.
I am trying to delay another way like this:
try {
Robot robot = new Robot();
robot.delay(5000);
//My code here..
} catch (AWTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
The problem is, is that it freezes my hole application just like Thread.sleep(ms) would do if you slept the main thread of the application.
I was wondering if there is any way around it freezing my hole application.