Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMenu hides behind components

 
Barry Andrews
Ranch Hand
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure the checkbox is a Swing JCheckBox, and not an AWT Checkbox... heavyweight and lightweight components don't play together well...
 
Barry Andrews
Ranch Hand
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using all swing components. No awt.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at this example... how does it compare with what's happening in your code...

 
Barry Andrews
Ranch Hand
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic