Index: openide/src/org/openide/awt/JPopupMenuPlus.java =================================================================== RCS file: /cvs/openide/src/org/openide/awt/JPopupMenuPlus.java,v retrieving revision 1.5 diff -u -r1.5 JPopupMenuPlus.java --- openide/src/org/openide/awt/JPopupMenuPlus.java 3 Apr 2002 12:11:57 -0000 1.5 +++ openide/src/org/openide/awt/JPopupMenuPlus.java 8 Apr 2003 13:27:38 -0000 @@ -18,6 +18,9 @@ import java.awt.Component; import java.awt.Point; +import org.openide.modules.Dependency; +import org.openide.modules.SpecificationVersion; + /** A subclass of JPopupMenu which ensures that the popup menus do * not stretch off the edges of the screen. * @@ -25,7 +28,10 @@ public class JPopupMenuPlus extends JPopupMenu { public JPopupMenuPlus() { - setUI(new NbPopupMenuUI()); + //fix for issue 32633 + if (needHackUI()) { + setUI(new NbPopupMenuUI()); + } } /* @@ -44,5 +50,14 @@ Point newPt = JPopupMenuUtils.getPopupMenuOrigin(this, p); SwingUtilities.convertPointFromScreen (newPt, invoker); super.show(invoker, newPt.x, newPt.y); + } + + /** Determine if this is JDK 1.3, in which case the replacement UI class + * NbPopupMenuUI is needed to handle accessibility issues. */ + static final boolean needHackUI () { + //Testing for 1.4.1 rather than 1.4, since eliminating NbPopupMenuUI + //has not been tested on 1.3 + return Dependency.JAVA_SPEC.compareTo( + new SpecificationVersion("1.4.1")) < 0; // NOI18N } } Index: openide/src/org/openide/awt/NbPopupMenuUI.java =================================================================== RCS file: /cvs/openide/src/org/openide/awt/NbPopupMenuUI.java,v retrieving revision 1.3 diff -u -r1.3 NbPopupMenuUI.java --- openide/src/org/openide/awt/NbPopupMenuUI.java 19 Nov 2001 12:44:26 -0000 1.3 +++ openide/src/org/openide/awt/NbPopupMenuUI.java 8 Apr 2003 13:27:38 -0000 @@ -28,7 +28,9 @@ import javax.swing.plaf.basic.BasicPopupMenuUI; /** - * Controlls keys for PopupMenu - UP, DOWN, LEFT, RIGHT, ESCAPE, RETURN + * Controlls keys for PopupMenu - UP, DOWN, LEFT, RIGHT, ESCAPE, RETURN. + * This class is only needed for menus on JDK 1.3, and should be deleted + * once 1.3 is no longer supported. */ final class NbPopupMenuUI extends BasicPopupMenuUI { @@ -338,10 +340,11 @@ static void changeTargetUI(JPopupMenu menu) { - if (menu.getUI() instanceof NbPopupMenuUI) { - return; + //Only use NbPopupMenuUI if running on 1.3 + //fix for issue 32633 + if ((!(menu.getUI() instanceof NbPopupMenuUI)) && + JPopupMenuPlus.needHackUI()) { + menu.setUI(new NbPopupMenuUI()); } - - menu.setUI(new NbPopupMenuUI()); } }