Forums Register Login

JMenuItem is not visible, why?

+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
"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.
Crusading Chameleon likes the size of this ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1564 times.
Similar Threads
Why JMenuItem is hidden by AWT component?
JMenuBar hidden...
Drawing
why JMenuItem is hidden by AWT component?
JMenuBar hidden...
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:53:23.