diff options
Diffstat (limited to 'libjava/java/awt/Window.java')
-rw-r--r-- | libjava/java/awt/Window.java | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java index 3554bf5..ad4aec7 100644 --- a/libjava/java/awt/Window.java +++ b/libjava/java/awt/Window.java @@ -209,7 +209,8 @@ public class Window extends Container implements Accessible } /** - * Makes this window visible and brings it to the front. + * Shows on-screen this window and any of its owned windows for whom + * isVisible returns true. */ public void show() { @@ -218,6 +219,26 @@ public class Window extends Container implements Accessible if (peer == null) addNotify(); + // Show visible owned windows. + synchronized (ownedWindows) + { + Iterator e = ownedWindows.iterator(); + while(e.hasNext()) + { + Window w = (Window)(((Reference) e.next()).get()); + if (w != null) + { + if (w.isVisible()) + w.getPeer().setVisible(true); + } + else + // Remove null weak reference from ownedWindows. + // Unfortunately this can't be done in the Window's + // finalize method because there is no way to guarantee + // synchronous access to ownedWindows there. + e.remove(); + } + } validate(); super.show(); toFront(); @@ -225,6 +246,7 @@ public class Window extends Container implements Accessible public void hide() { + // Hide visible owned windows. synchronized (ownedWindows) { Iterator e = ownedWindows.iterator(); @@ -232,16 +254,14 @@ public class Window extends Container implements Accessible { Window w = (Window)(((Reference) e.next()).get()); if (w != null) - w.hide(); + { + if (w.isVisible() && w.getPeer() != null) + w.getPeer().setVisible(false); + } else - // Remove null weak reference from ownedWindows. - // Unfortunately this can't be done in the Window's - // finalize method because there is no way to guarantee - // synchronous access to ownedWindows there. e.remove(); } } - super.hide(); } |