Here\'s my code:
package javaapplication2;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class
Because painting happens in the Event Dispatch Thread, and you're blocking it with your obvious infinite loop. This will prevent any further painting from happening, events from being processed, and anything else that happens inside the EDT.
That's why you never perform long running operations on EDT, but use a SwingWorker or other mechanism instead.