JDK-6232687 : Window.SetLocationRelativeTo: treat the given null and invisible component separately
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-02-24
  • Updated: 2017-05-16
  • Resolved: 2011-05-17
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 Other
7 b19Fixed OpenJDK6Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
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

Comments
EVALUATION The problem in 6177452 was the wrong Window placement in the case of the given component is null or invisible, and it has been fixed. While working on the bug a new suggestion had appeared: to treat the given null component separately from invisible one. That should be a distinct RFE and is not connected with the fix for 6177452. ###@###.### 2005-2-25 13:15:07 GMT
25-02-2005