I have a Java program that uses threads. In my run method, I have:
public void run() {
while(thread != null){
repaint();
System.out.print
Cal repaint from a Swing Timer. That will not block the GUI, and will happen at whatever interval specified in the timer. Of course, by the nature of Swing/AWT painting, if the timer is set to repeat too fast, calls to paint might be coalesced (effectively ignored).
Also, make sure the method is an override using:
@Override
public void paintComponent(Graphics g){