File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JMenu hides behind components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JMenu hides behind components" Watch "JMenu hides behind components" New topic
Author

JMenu hides behind components

Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

Has anyone ever seen this? I just have a JFrame with a JMenuBar set on it with JFrame.setJMenuBar() method. The JFrame is using a JPanel with layout set to null, then I am just hardcoding the x,y,w,h with setBounds() method on each component. When I drop the menu down, it shows behind a checkbox, i.e. the checkbox hides it. I think this is very odd. If anyone has seen this before, I would like to hear.
Many thanks,
Barry
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Make sure the checkbox is a Swing JCheckBox, and not an AWT Checkbox... heavyweight and lightweight components don't play together well...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

I am using all swing components. No awt.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Look at this example... how does it compare with what's happening in your code...

Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

Oops!!! Sorry, yes I am using awt for the checkbox. I didn't mean to do that. I forgot to put the prefix J. Thanks for your help!!

Barry
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JMenu hides behind components
 
Similar Threads
Head First Java Question - GUI program TwoButtons
Editable screensaver that is running all the time
Weird Problem
JMenu Menu hiding behind JPanel
CastMap getTrimmedString() error?