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 |
* |
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 |
/* |
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 |
} |