• 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: 42970
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
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!