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

Window.SetLocationRelativeTo: treat the given null and invisible component separately

XMLWordPrintable

    • b19
    • generic
    • generic
    • Not verified

        On a multi-monitor configuration, Window.setLocationRelativeTo() places the window incorrectly when the given component is invisible. For this, a fix was suggested in Bug 6177452. The fix is to obtain the GC from the invisible component and center the window in the same screen to which the invisible component actually belongs. So ideally the case of arg being null and arg being invisible must be handled separately.

        But in the PIT build, the above 2 cases are handled in the same way where the window is placed at the location returned by GE.getCenterPoint(). So even when invisible component belongs to the sec screen, the window will always appear at the center of the primary monitor since GE.getCenterPoint() will always return the center of primary monitor on Win32.

        Here is the PIT build:
        java version "awt.pit-jcg-win-03-2005-02-22-Tue-int.mustang"
        Java(TM) 2 Runtime Environment, Standard Edition (build awt.pit-jcg-win-03-2005-02-22-Tue-int.mustang)
        Java HotSpot(TM) Client VM (build 1.6.0-ea-b24, mixed mode)

        This is reproducible with the above PIT build as well as older builds on all platforms. I have marked it as PIT bug since the bug 6177452 is only partially fixed in the above PIT build.

        I have attached a sample test. Run the sample test. It would popup a frame which is placed in relative to an invisible as well as null component. Compare the locations with mid point / center point. If it always matches the center point, the bug is reproduced. Try this on a multi-monitor system. Ideally Frame should appear on primary initially and secondary later on. If all the frames appear on the same screen one after other, bug is reproduced.
        ###@###.### 2005-2-24 15:21:54 GMT

              art Artem Ananiev (Inactive)
              pmohansunw Praveen Mohan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: