When I try to use any kind of delay on my code the program gets delayed but the JLabel that was put before the delay gets updated after the program ends.
I want the program to:
- update the JLabel on the GUI
- wait for 5 seconds
- update the JLabel again with diferent text
- wait another 5 seconds
I have tried with timers, invokelater, invokeandwait, thread.sleep and others.
The problems is that the GUI does get delayed at the right spot but the GUI does not update the JLabel ath place where the code is located. The JLabel gets updated after the program ends.
I want the user to be able to read the text for 5 seconds then read another text for another 5 seconds in order. I do not want the program to run the gui pause at a cetain spot then at end just update the JLabel. I want the gui to get updated before the delay. I do not want the same thing that when I used a timer to happen where I type in a setText for the JLabel before the Timer is typed and then when I run the program the timer works but the JLabel gets updated after the delay(It is not what I want).