JDK-7182121 : [macosx] A JDialog appears on wrong place when using dual display on Mac
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-07-06
  • Updated: 2012-07-17
  • Resolved: 2012-07-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
7u6Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.7.4

A DESCRIPTION OF THE PROBLEM :
The default position of JDialog is wrong when I use 2 displays on Mac OS X.
It appears on top right of the second dsiplay every time.
It appears on left end of second display if the parent JFrame is on the first display and JDialog#setLocationRelativeTo is called.

REGRESSION.  Last worked in version 7

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1,Execute a class I appended on a Mac with 2 displays and Java7.

java test.DialogTest

2,Move the window anywhere you want and push the button on the window.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A dialog appears on the same place of the window.
ACTUAL -
A dialog appears second display even the parent window is on the first display.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package test;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class DialogTest extends JFrame {
	public DialogTest() {
		JButton button = new JButton("go");
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				JDialog dialog = new JDialog(DialogTest.this, true);
				dialog.getContentPane().add(new JLabel("test"));
				dialog.pack();
				dialog.setLocationRelativeTo(DialogTest.this);
				dialog.setVisible(true);
			}
		});
		
		getContentPane().add(button);
	}
	
	public static void main(String[] args) {
		DialogTest dialogTest = new DialogTest();
		dialogTest.pack();
		dialogTest.setVisible(true);
	}
}

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