The new object b that is created is not the one being shown. You need to get access to the component that is currently being shown.
Type: Posts; User: Norm
The new object b that is created is not the one being shown. You need to get access to the component that is currently being shown.
You need to use a reference to the component class that contains the repaint() method to call it:
refToClassWithRepaint.repaint();
The AddColor class does not have a repaint() method.
Calling the repaint() method in the paintComponent() method doesn't make sense. I think it could cause a tight loop. The repaint() method tells the JVM to call the painting methods.
Call the...
After you do something that you want to cause the paintComponent() method to be called, call the repaint() method to tell the JVM to call paintComponent()