summaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/PopupFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/swing/PopupFactory.java')
-rw-r--r--libjava/classpath/javax/swing/PopupFactory.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/libjava/classpath/javax/swing/PopupFactory.java b/libjava/classpath/javax/swing/PopupFactory.java
index 7bb2529cd54..b326205999c 100644
--- a/libjava/classpath/javax/swing/PopupFactory.java
+++ b/libjava/classpath/javax/swing/PopupFactory.java
@@ -152,13 +152,18 @@ public class PopupFactory
// If we have a root pane and the contents fits within the root pane and
// lightweight popups are enabled, than we can use a lightweight popup.
JRootPane root = SwingUtilities.getRootPane(owner);
- Point rootLoc = root.getLocationOnScreen();
- Dimension contentsSize = contents.getSize();
- Dimension rootSize = root.getSize();
- if (x >= rootLoc.x && y > rootLoc.y
- && (x - rootLoc.x) + contentsSize.width < rootSize.width
- && (y - rootLoc.y) + contentsSize.height < rootSize.height)
- popup = new Popup.LightweightPopup(owner, contents, x, y);
+ if (root != null)
+ {
+ Point rootLoc = root.getLocationOnScreen();
+ Dimension contentsSize = contents.getSize();
+ Dimension rootSize = root.getSize();
+ if (x >= rootLoc.x && y > rootLoc.y
+ && (x - rootLoc.x) + contentsSize.width < rootSize.width
+ && (y - rootLoc.y) + contentsSize.height < rootSize.height)
+ popup = new Popup.LightweightPopup(owner, contents, x, y);
+ else
+ popup = new Popup.JWindowPopup(owner, contents, x, y);
+ }
else
popup = new Popup.JWindowPopup(owner, contents, x, y);
return popup;