aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Updating JPanel obscuring JMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Updating JPanel obscuring JMenu" Watch "Updating JPanel obscuring JMenu" New topic
Author

Updating JPanel obscuring JMenu

J S
Greenhorn

Joined: May 29, 2003
Posts: 1
Oh, this one might drive me into the ground -- please help!
I have a JPanel that is being drawn on and updated by a swing timer. The swing timer generates an ActionEvent every 30ms and the JPanel has an ActionEventListener that handles the event by calling update(getGraphics()). In the JPanel's paintComponent method, I am drawing an object (which is actually a seperate thread) that is moving, thus the animation. The problem is that the damn JPanel is constantly over the top of my menu.
I've seen numerous issues that seem similar to mine regarding light/heavyweight component problems -- but these are both supposed to be lightweight components! How do I make the menu always on top of a JPanel that is handling a swing timer for animation?
Obscured,
Joe
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Try using the repaint() method instead of update(getGraphics())... that's "The Way You're Supposed To Repaint"™


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Updating JPanel obscuring JMenu