This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Problems with swing components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problems with swing components" Watch "Problems with swing components" New topic

Problems with swing components

Paul Bull
Ranch Hand

Joined: Feb 14, 2001
Posts: 37
Hello Everyone,
I have a problem I'm hoping someone can help me solve.
I am working on a gui interface. It consists of a JFrame. I added
a JMenuBar to the top of the JFrame using the setJMenuBar() method. Next I added a vertical Box set at BorderLayout.NORTH. In the vertical Box I added two horizontal Boxes. The top Box contains two Choice fields. The bottom contains a textfield. My problem is, when I click "file" on the MenuBar, the pull down menu with my menu items is partially hidden behind a Choice field and textfield below it. Is there anything I can do with these components so my pull down menu is not obscured by these components below it?
Any advice would be greatly appreciated.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
The problem is that you are mixing AWT heavyweight things (Boxes) with Swing lightweight things (JFrames and JMenuBars). The heavyweight things will always hide the lightweight things.
You need to decide Swing or AWT and then stick with that.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Paul Bull
Ranch Hand

Joined: Feb 14, 2001
Posts: 37
Thanks Cindy
It is sorta covered in the JavaRanch Style Guide.
subject: Problems with swing components
Similar Threads
Components vs Container (and Menu)
Combo over pull-down menu
'select' box interferring with my pulldown menu
Sarga Qns
List box appearing over JMenuBar dropdown