So I am trying to draw a label which contains an icon showing a circle. The circle will initially be filled red, and then depending on which of the 3 buttons I press, it will ei
Ellipse2D.Double circle = new Ellipse2D.Double(50, 50, 10, 10);
The size of the icon is (10, 10). 50, is outside the bounds of the Icon. Painting is done relative to the icon so the ellipse should be:
Ellipse2D.Double circle = new Ellipse2D.Double(0, 0, 10, 10);
it will either change to green, blue, or red using repaint.
Your ColorChanger class will need a setColor(Color color)
method so that you can dynamically change the color to be painted. The paintIcon() method should then use this color.