wood burning stoves*
The moose likes Applets and the fly likes Applet doesn't repaint properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet doesn Watch "Applet doesn New topic
Author

Applet doesn't repaint properly

Steve O Smith
Greenhorn

Joined: Aug 19, 2010
Posts: 8
This applet doesn't repaint properly after it's minimized or another window gets on top of it.




Don't I need a repaint or update method here?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41134
    
  45
You shouldn't use the paint method with Swing, but the paintComponent method; paint is for AWT components.


Ping & DNS - my free Android networking tools app
Steve O Smith
Greenhorn

Joined: Aug 19, 2010
Posts: 8
Wow. That's the method used in the textbook for my intro to compsci class. The examples in the book have the same problem.

Didn't the author think to, oh I don't know, google this or ask on a forum? Jeez.

Thanks. I'll look into paintcomponent().
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

JApplet doesn't have a paintComponent(...) method. Custom painting in Swing is best done in an extended JComponent or JPanel, by overriding the paintComponent(...) method mentioned by Ulf. More here: Lesson: Performing Custom Painting.


luck, db
There are no new questions, but there may be new answers.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Applet doesn't repaint properly
 
Similar Threads
How to properly create an applet with an Input field and some shapes.
Problem with methods to do graphics.
I am having proble with a method
Help understanding why mouse event seems to be registering twice.
applet problems