I made a JApplet with JMenu, but when it is pulled down, the JMenuItem is not visible, part of which is hidden by the component below. I have a Canvas added in a JPanel than add JPanel in the center of JApplet, then I find the canvas hides the JMenuItem, but when I tried with Swing class instead of Canvas, it's OK. How can I use AWT class like Canvas, but not hide the JMenuItem? Thanks a lot!
Hi wonda, If u try to mix swing and awt components u r expected to get unpredictable results. the reason is that u can't mix lightweight(swing) components with heavyweight components(awt). and I don't think there is any way to mix them without getting unexpected o/p. regards deekasha
The heavyweight (awt)components will always hide your lightweight components (swing). If you feel you must have the canvas instead of a JPanel or JLabel, you will have to move your canvas to another area so that it does not hide your menu items.
You can force your menu to be heavyweight by using the following statement: JPopupMenu.setDefaultLightWeightPopupEnabled(false); This will cause the menu always to be painted over anything else.
"wonda", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements. Thanks.
Post by:autobot
Crusading Chameleon likes the size of this ad:
a bit of art, as a gift, that will fit in a stocking