Hi, I've been trying to track down a problem I am having.
I'm changing Red/Yellow/Green by calling setRed etc and calling repaint(). It seems to somewhat be working, in that I can track it going through paintComponent. However, it not repainting the screen.
I understand things may 'wait' for a while, (and I don't want this to sound too dumb) but are we saying it could take a minutes to repaint, which seems like forever. When I stretch the screen - boom - repaints immediately.
If I use a value in repaint(long x) what would an appropriate value be? Have also tried to put validate() in place of (and in conjunction with) repaint.
public class NewPanel extends JPanel {
public static boolean Red = false; public static boolean Yellow = false; public static boolean Green = false;
public void paintComponent(Graphics g) { super.paintComponent(g);
public void setRed(){ System.out.println("Setting Red to True"); Red = true; Yellow = false; Green = false; repaint(); } public void setYellow(){ System.out.println("Setting Yellow to True"); Red = false; Yellow = true; Green = false; repaint();
} public void setGreen(){ System.out.println("Setting Green to True"); Red = false; Yellow = false; Green = true; repaint();