Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet re-painting

 
Matthew Plant
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple applet within a JSP.
The applet extends JApplet and overides its paint method to draw some simple shapes to the screen.

Problem is if I minimise the browser window and re-open it or scroll the applet off the page briefly then it never re-paints itself so you end up with a grey box.

I though paint was called by the system as required.

Am I wrong?

Thanks.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use Swing components (like JApplet) then you need to override paintComponent, not paint. That's a difference between AWT and Swing. Just change the method name and it should be fine.
 
Matthew Plant
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ha ha, there's a reason you're a sherif and i'm a green horn.

Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic