aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes List box appearing over JMenuBar dropdown Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "List box appearing over JMenuBar dropdown" Watch "List box appearing over JMenuBar dropdown" New topic
Author

List box appearing over JMenuBar dropdown

Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
I have written an application which contains a JMenuBar at the top of the screen. There is also a java.awt.list box at the top immediately under the menu bar.

My problem is that this top list box appears ON TOP of a menu when dropped down. The menu itself still works fine however as I can simply click the menu header (ie: File) and cursor to the item I want to use (ie: Open, though I cannot see it).

I expect there is a method to put one more present than another, but I have not been able to find this conflict via JavaRanch search or google (likely)... or maybe this is a bug?? (stretching it)

I have tried re-arranging the order which I add the components to my Content Pane but this did not help.

Thanks in advance.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15292
    
    6

Change your List(heavy-weight) to a JList(light-weight) and all will work well. See Mixing Heavy Weight and Light Weight Components for more information.


GenRocket - Experts at Building Test Data
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
Thanks Gregg for the reply..

I'm trying to convert it to a JList but that's easier said than done. List really did exactly what I wanted (and had it working great aside from this menu bug) and unfortunately it's not as easy as renaming some functions to make it work. I'll post back once I have it finished.
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
Nevermind.. I know this is the easy way out, but I'm just going to leave some space at the top to show the menus (they're small) so I don't have to deal with this conversion. After about 20 minutes it's not coming along very well at all.

I should have started with JList and it would have been fine, but since I didn't, it's too much of a hastle (and too much customer $$) for me to make the conversion now.

Thanks for the help. I'll be sure to use JList next time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: List box appearing over JMenuBar dropdown
 
Similar Threads
Problems with swing components
Applets and overlapping menu items
Applets and overlapping menus in web browsers
JMenuBar not using default alignment?
Coordinates of a object in javascript...