Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Urgent - pls help

 
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
I have a frame with a menu. Now just below the menu i have a JButton. My problem is that when i click on the menu, i get my menuitems. But unfortunately, the menuitem is almost at the same position as the JButton. But instead of the JMenuItem appearing in front of the JButton, i get the JButton in front of JMenuItem . Thus my JMenuItem is partially hidden bu the JButton. How do i overcome this. What i want is when i click on the menu, the menuitem should come over the JButton.
I hope u guys help me out.
Regards
Saj
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
if you place the button in the default layer, the menu would cover the button as it is painted in another layer (above the default one). (see the API for JRootPane, and the swing tutorial for detailed information.)
have you added the button this way?:
JFrame f = new JFrame();
Container content = f.getContentPane();
content.setLayout(new BorderLayout()); //or whatever layout
content.add(new JButton("under menu"), BorderLayout.NORTH);
JMenuBar bar = new JMenuBar();
// configure menubar
f.setJMenuBar(bar);
chantal
 
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic