View Full Version : JMenuBar with Canvas
04-02-2008, 11:13 PM
I'm making a small game and my main class extends Canvas. In my main method I construct a JMenuBar and add it to my JFrame. I then add a canvas to the JFrame using frame.getContentPane().add(myclassname). The problem is when I click on a category on my menubar it's opening up behind my canvas. Is there any way to get it to open in front of it? Thanks.
04-08-2008, 05:08 AM
The problem you're encountering is mixing lightweight(JMenuBar) and heavyweight(Canvas) components. A common issue but it's easily correctable. Use the JPopupMenu.setLightWeightPopupEnabled() method. Here's a link with a more in depth description of the problem.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.