• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Updating JPanel obscuring JMenu

 
J S
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using the repaint() method instead of update(getGraphics())... that's "The Way You're Supposed To Repaint"™
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic