If you override the paint() method with something simpler, like just colouring everything green, does that work?
Joined: Jul 19, 2011
Paul Clapham wrote:If you override the paint() method with something simpler, like just colouring everything green, does that work?
no, I tried removing anything involving images and just drew a a line, but it didn't work. I find this extremely weird because the code is taken almost line for line from my pong program, and than runs fine.
Try making a call to the super classes's paint method. Something like this.
Also depending on what component your using to draw (if your using Swing or AWT) it is usually better to override paintComponent(). The reason for this is AWT uses paint() which handles other things like painting the components border, and the components "children", not just painting the component itself. Swing however, uses three paint methods paintComponent(), paintBorder(), and paintChildren() to do all the painting. So if your using a Swing component overriding paintComponent() means your not messing with the component's border and child painting.