How do I re run the paint method so the JPanel is animated?
问题 I think I need to put some code where the comment is (or maybe use non static method but I am not sure). The main method creates the window and then starts the graphics method. I would like the blue square to flash. import java.awt.Color; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class paintTest extends JPanel{ private static JFrame theWindow = new JFrame("Window"); static boolean blueSqr = false; public void paint(Graphics g) { g.setColor(Color