wood burning stoves 2.0
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
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet doesn Watch "Applet doesn New topic

Applet doesn't repaint properly

Steve O Smith

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

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

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

Joined: May 03, 2008
Posts: 5091

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.
I agree. Here's the link: http://aspose.com/file-tools
subject: Applet doesn't repaint properly
It's not a secret anymore!