This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 32633
Collapse All | Expand All

(-)openide/src/org/openide/awt/JPopupMenuPlus.java (-1 / +16 lines)
Lines 18-23 Link Here
18
import java.awt.Component;
18
import java.awt.Component;
19
import java.awt.Point;
19
import java.awt.Point;
20
20
21
import org.openide.modules.Dependency;
22
import org.openide.modules.SpecificationVersion;
23
21
/** A subclass of JPopupMenu which ensures that the popup menus do
24
/** A subclass of JPopupMenu which ensures that the popup menus do
22
 * not stretch off the edges of the screen.
25
 * not stretch off the edges of the screen.
23
 *
26
 *
Lines 25-31 Link Here
25
public class JPopupMenuPlus extends JPopupMenu {
28
public class JPopupMenuPlus extends JPopupMenu {
26
    
29
    
27
    public JPopupMenuPlus() {
30
    public JPopupMenuPlus() {
28
        setUI(new NbPopupMenuUI());
31
        //fix for issue 32633
32
        if (needHackUI()) {
33
            setUI(new NbPopupMenuUI());
34
        }
29
    }
35
    }
30
36
31
    /*
37
    /*
Lines 44-48 Link Here
44
        Point newPt = JPopupMenuUtils.getPopupMenuOrigin(this, p);
50
        Point newPt = JPopupMenuUtils.getPopupMenuOrigin(this, p);
45
        SwingUtilities.convertPointFromScreen (newPt, invoker);
51
        SwingUtilities.convertPointFromScreen (newPt, invoker);
46
        super.show(invoker, newPt.x, newPt.y);
52
        super.show(invoker, newPt.x, newPt.y);
53
    }
54
    
55
    /** Determine if this is JDK 1.3, in which case the replacement UI class
56
     *  NbPopupMenuUI is needed to handle accessibility issues.  */
57
    static final boolean needHackUI () {
58
        //Testing for 1.4.1 rather than 1.4, since eliminating NbPopupMenuUI
59
        //has not been tested on 1.3
60
        return Dependency.JAVA_SPEC.compareTo(
61
            new SpecificationVersion("1.4.1")) < 0; // NOI18N
47
    }
62
    }
48
}
63
}
(-)openide/src/org/openide/awt/NbPopupMenuUI.java (-5 / +8 lines)
Lines 28-34 Link Here
28
import javax.swing.plaf.basic.BasicPopupMenuUI;
28
import javax.swing.plaf.basic.BasicPopupMenuUI;
29
29
30
/**
30
/**
31
 * Controlls keys for PopupMenu - UP, DOWN, LEFT, RIGHT, ESCAPE, RETURN
31
 * Controlls keys for PopupMenu - UP, DOWN, LEFT, RIGHT, ESCAPE, RETURN.
32
 * This class is only needed for menus on JDK 1.3, and should be deleted
33
 * once 1.3 is no longer supported.
32
 */
34
 */
33
final class NbPopupMenuUI extends BasicPopupMenuUI {
35
final class NbPopupMenuUI extends BasicPopupMenuUI {
34
36
Lines 338-347 Link Here
338
    
340
    
339
    
341
    
340
    static void changeTargetUI(JPopupMenu menu) {
342
    static void changeTargetUI(JPopupMenu menu) {
341
        if (menu.getUI() instanceof NbPopupMenuUI) {
343
       //Only use NbPopupMenuUI if running on 1.3
342
            return;
344
       //fix for issue 32633
345
       if ((!(menu.getUI() instanceof NbPopupMenuUI)) &&
346
            JPopupMenuPlus.needHackUI()) {
347
            menu.setUI(new NbPopupMenuUI());
343
        }
348
        }
344
        
345
        menu.setUI(new NbPopupMenuUI());
346
    }
349
    }
347
}
350
}

Return to bug 32633