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

Swing application window appears in incorrect location

    XMLWordPrintable

Details

    • x86
    • windows_xp

    Description

      FULL PRODUCT VERSION :
      java version "1.6.0_06"
      Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
      Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      The Java VM is running on a remote Linux system (Ubuntu 8.04) through SSH and being displayed on the Windows client using X11 forwarding in Cygwin.

      A DESCRIPTION OF THE PROBLEM :
      This problem does not exist if the application is run locally. If I run the test case in Java 6 (through SSH and with X-Forwarding), the window briefly appears in the correct location, but then moves several pixels up and to the left.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Open a terminal window in Cygwin on Windows XP.
      2. SSH, with X11 forwarding enabled, into a Linux machine with Java 6 installed.
      3. Run the test case.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The window appears at the location specified in the source code.
      ACTUAL -
      The window briefly appears in the correct location, then moves up and to the left.

      It is even more obvious if you run the same test case using Java 5 also. The Java 5 window will come up in the correct place, but the Java 6 window will come up and then move, clearly having an offset from the Java 5 window.

      It looks like the offset is exactly the height of the title bar and the width of the border, if that is a clue. In other words, if you have the window open in the correct location on top of the window in the incorrect location, you can see exactly the title bar and the left border of the window underneath.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JFrame;

      public class WindowTest {
          private static JFrame frame;
          public static void main(String[] args) {
      frame = new JFrame("Test App");
      frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
      frame.setSize(800, 600);
      //frame.pack(); // uncomment this line and it no longer jumps
      frame.setLocation(50, 50);
      frame.setVisible(true);
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Uncomment the "pack()" line in the test case. However this isn't a true workaround, because it's not always desirable to use pack().

      Release Regression From : 5
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

      Attachments

        Activity

          People

            art Artem Ananiev (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Imported:
              Indexed: