aspose file tools*
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: 39551
You shouldn't use the paint method with Swing, but the paintComponent method; paint is for AWT components.

Ping & DNS - updated with new look and Ping home screen widget
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: 4523

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:
subject: Applet doesn't repaint properly
Similar Threads
I am having proble with a method
applet problems
How to properly create an applet with an Input field and some shapes.
Problem with methods to do graphics.
Help understanding why mouse event seems to be registering twice.