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 / +17 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
            System.out.println("Using hacked ui");
34
            setUI(new NbPopupMenuUI());
35
        }
29
    }
36
    }
30
37
31
    /*
38
    /*
Lines 44-48 Link Here
44
        Point newPt = JPopupMenuUtils.getPopupMenuOrigin(this, p);
51
        Point newPt = JPopupMenuUtils.getPopupMenuOrigin(this, p);
45
        SwingUtilities.convertPointFromScreen (newPt, invoker);
52
        SwingUtilities.convertPointFromScreen (newPt, invoker);
46
        super.show(invoker, newPt.x, newPt.y);
53
        super.show(invoker, newPt.x, newPt.y);
54
    }
55
    
56
    /** Determine if this is JDK 1.3, in which case the replacement UI class
57
     *  NbPopupMenuUI is needed to handle accessibility issues.  */
58
    static final boolean needHackUI () {
59
        //Testing for 1.4.1 rather than 1.4, since eliminating NbPopupMenuUI
60
        //has not been tested on 1.3
61
        return (Dependency.JAVA_SPEC.compareTo(
62
            new SpecificationVersion("1.4")) < 0); // NOI18N
47
    }
63
    }
48
}
64
}
(-)openide/src/org/openide/awt/NbPopupMenuUI.java (-5 / +9 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
                System.out.println("Using hacked ui");
348
            menu.setUI(new NbPopupMenuUI());
343
        }
349
        }
344
        
345
        menu.setUI(new NbPopupMenuUI());
346
    }
350
    }
347
}
351
}

Return to bug 32633