JDK-6380835 : Child Windows not slaved to parent on Linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2006-02-03
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b03Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux muellerp02linux 2.6.11.4-20a-smp #1 SMP Wed Mar 23 21:52:37 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux

EXTRA RELEVANT SYSTEM CONFIGURATION :
I also observe this problem on 32-bit Linux and under the 12 Jan 2006 Snapshot release of Java 6.

A DESCRIPTION OF THE PROBLEM :
On Linux, Java windows that are parented to a Java frame don't follow the frame's state as expected.  For example, if the frame is minimized the child windows remain visible.  If another frame is activated on top of a frame that has children, the children remain in front of both frames.

On Windows the children behave as exepected, disappearing when their parent is minimized and going behind frames that are on top of their parent.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the provided code: java ChildWindowProblem

2. Observe that the child window appears on-top of both its parent frame and the other frame.

3. Minimize the parent frame and observe that the child stays visible

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
2. I exepct the child to go behind the frame that is not its parent when that frame is on top.

3. I expect the child to disappear when its parent is minimized.
ACTUAL -
2. The child is always on top of all frames

3. The child remains when the parent is minimized

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;

public class ChildWindowProblem
{
    public static void main(String[] args) {

        JFrame  parentFrame = new JFrame("Parent Frame");
        parentFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JWindow childWindow = new JWindow(parentFrame);
        JLabel childLabel = new JLabel("Child Window");
        childLabel.setHorizontalAlignment(JLabel.CENTER);
        childLabel.setBorder(BorderFactory.createLineBorder(Color.blue.darker(), 5));
        childWindow.getContentPane().add(childLabel);
        JFrame  otherFrame  = new JFrame("Other Frame");

        parentFrame.setBounds(100, 100, 600, 400);
        childWindow.setBounds(200, 200, 300, 200);
        otherFrame.setBounds(150, 150, 300, 400);

        parentFrame.setVisible(true);
        childWindow.setVisible(true);
        otherFrame.setVisible(true);
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I've been able to work around this using a WindowListener on the parent frame.  The WindowListener hides/shows owned children when the frame is iconified/deiconified.  It also calls toBack/toFront on the children in response to windowDeactivated/windowActivated.

The latter part of this workaround is less than ideal.

Comments
EVALUATION Part of window problems - in fact, most of them - is due to override-redirect nature of Window.
03-02-2006