Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6380835

Child Windows not slaved to parent on Linux

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b03
    • CPU:
      x86
    • OS:
      linux
    • Verification:
      Verified

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yan Yuri Nesterenko
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: