So I am having an issue with making a thread as EDT. This is the prototype of program I have:
The program also has a keyListener and the repainting is related with the button is pressed. I tried to do like this, but it just made the program to freeze:
I've read several topics about EDT, but I couldn't find info about the issue I have.public class Program { public Program() { SwingUtilities.invokeLater/invokeAndWait(new Runnable() { public void run() { while(true) { ... repaint(); Thread.sleep(x); } } }); } public static void main(String[] args) { Program p = new Program(); } public void paintComponent(g) { ... } }