I have a a Java application that uses Java3D and JPopupMenus filled with JMenuItems. Everything works fine when it runs as a regular application-- the JPopupMenus and everything else behave as expected. However, when I make an applet out of the application, the JPopupMenu that pops up entirely over the Canvas3D does not act as expected. The JPopupMenu behaves as follows:
- The menu items do not highlight as the mouse moves over them
- The arrow keys cannot be used to move through the menu items
- Clicking on a top-level JMenuItem completes the action and highlights the item, but it does not dispose of the JPopupMenu as it does in the regular application
- Clicking on a top-level JMenuItem that contatins a submenu does nothing
- Clicking outside of the JPopupMenu does not dispose of the JPopupMenu as it does in the regular application
- With the JPopupMenu displayed, opening a JPopupMenu on top of the swing portion of my program enables regular and expected behavior of the JPopupMenu over the Canvas3D, but point 5 still applies
Some more information:
- The JPopupMenu is displayed with JPopupMenu.show() in relation to the JPanel holding the Canvas3D
- I am calling JPopupMenu.setDefaultLightWeightPopupEnabled(false) before the creation of any JPopupMenus, but this line doesn't seem to make a difference.
- I thought that this might have been a focus issue, but JPopupMenu.requestFocusInWindow() doesn't work
So my question is: what is causing the behavior to be different between the application and the applet, and how can I make the JPopupMenu in the applet function as it does in the application?