This content has been marked as final. Show 1 reply
You're doing a couple things wrong in the small amount of code you posted. I can't think of an instance where you would need to call getGraphics() on a Component. If you use that method, chances are high you're doing it wrong. Try replacing that whole statement with repaint(). Second, when doing custom painting in swing you should override the paintComponent() method instead of paint() (also change the super call to paintComponent()).
Asside from that, you'll need to provide an SSCCE if you need more help.