summaryrefslogtreecommitdiff
path: root/javax/swing/SwingUtilities.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/SwingUtilities.java')
-rw-r--r--javax/swing/SwingUtilities.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/javax/swing/SwingUtilities.java b/javax/swing/SwingUtilities.java
index 82598ed64..9d8e8df38 100644
--- a/javax/swing/SwingUtilities.java
+++ b/javax/swing/SwingUtilities.java
@@ -376,29 +376,27 @@ public class SwingUtilities
public static Component getRoot(Component comp)
{
Applet app = null;
+ Window win = null;
while (comp != null)
{
- // A Window cannot be in an applet, so
- // the Window returned would be encountered
- // after the applet.
- if (app == null && comp instanceof Window)
- return (Window) comp;
+ if (win == null && comp instanceof Window)
+ win = (Window) comp;
else if (comp instanceof Applet)
app = (Applet) comp;
comp = comp.getParent();
}
+ if (win != null)
+ return win;
return app;
}
/**
- * Return true if a descends from b, in other words if b is an
- * ancestor of a.
- *
+ * Return true if a descends from b, in other words if b is an ancestor of a.
+ *
* @param a The child to search the ancestry of
* @param b The potential ancestor to search for
- *
* @return true if a is a descendent of b, false otherwise
*/
public static boolean isDescendingFrom(Component a, Component b)