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 |
System.out.println("Using hacked ui"); |
34 |
setUI(new NbPopupMenuUI()); |
35 |
} |
29 |
} |
36 |
} |
30 |
|
37 |
|
31 |
/* |
38 |
/* |
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 |
} |