Skip to main content

JPopupMenu problem in Applets

3 replies [Last post]
jimaltio
Offline
Joined: 2008-03-13
Points: 0

I have a problem with applets running in Java 6uN that doesn't appear when running in Java 1.5 or java 1.6.0_05. If the applet tries to create a popup window that is near to the applet border then it fails.

The problem seems to be when AWT thinks it needs to create a heavyweight window for the popup. I have attached a JAR file containing a simple applet that reproduces the problem by displaying a JPopupMenu from a JButton click. There are two buttons on the applet and they both work in all other JVM versions, but in the 6uN JVMs then only the top button works, and the second button fails with the following exception:

Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.awt.AWTPermission setWindowAlwaysOnTop)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.awt.Window.setAlwaysOnTop(Unknown Source)
at javax.swing.Popup$HeavyWeightWindow.(Unknown Source)
at javax.swing.Popup.createComponent(Unknown Source)
at javax.swing.Popup.reset(Unknown Source)
at javax.swing.PopupFactory$HeavyWeightPopup.getHeavyWeightPopup(Unknown Source)
at javax.swing.PopupFactory.getHeavyWeightPopup(Unknown Source)
at javax.swing.PopupFactory.getPopup(Unknown Source)
at javax.swing.PopupFactory.getPopup(Unknown Source)
at javax.swing.plaf.PopupMenuUI.getPopup(Unknown Source)
at javax.swing.JPopupMenu.getPopup(Unknown Source)
at javax.swing.JPopupMenu.setVisible(Unknown Source)
at javax.swing.JPopupMenu.show(Unknown Source)
at com.altio.examples.applets.PopupTest$3.actionPerformed(PopupTest.java:60)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Any help you can give would be much appreciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kbr
Offline
Joined: 2003-06-16
Points: 0

Thanks for the concise test case and sorry about the trouble. This is a regression caused by the fix for bug 6580930 earlier in the 6u10 release. I've filed a high-priority bug 6675802 about this which will show up in the Sun Bug Database within a day or two.

jimaltio
Offline
Joined: 2008-03-13
Points: 0

Thanks for that - I'll keep an eye out for a fix to that bug in a future release.

kbr
Offline
Joined: 2003-06-16
Points: 0

Let me just clarify -- later build, not later release. We won't ship 6u10 with this regression.