-
Type:
Bug
-
Status: Resolved
-
Priority:
P3
-
Resolution: Won't Fix
-
Affects Version/s: 7u21
-
Fix Version/s: None
-
Component/s: client-libs
-
Labels:
-
Subcomponent:
-
OS:os_x
FULL PRODUCT VERSION :
java version " 1.7.0_21 "
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.8.3 Build version: 12D78
Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
In an application with multiple JFrames visible if a modal dialog is created with an owner that is under another JFrame, when the modal dialog is set as visible it is also displayed under the non-owner JFrame.
The provided example works as expected in the following environments:
- Mac OS X 10.8.4 with Java 1.6.0_45
- Windows 7 with Java 1.6.0_45
- Windows 7 with Java 1.7.0_21
The behaviour is different in:
- Mac OS X 10.8.4 with Java 1.7.0_21
REGRESSION. Last worked in version 6u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create two JFrames, " main " and " secondary "
2. Set the " main " JFrame visible, followed by the " secondary "
3. Create a modal JDialog with the " main " JFrame as the owner
4. Make the new JDialog visible
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The owner JFrame is displayed " on top " of the secondary JFrame and the modal dialog on top of it's owner
ACTUAL -
The modal dialog is displayed behind the secondary JFrame
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class FrameTester {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final JFrame frame1 = new JFrame( " Main Frame " );
frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame1.setSize(300, 300);
frame1.setVisible(true);
JFrame frame2 = new JFrame( " Second Frame " );
frame2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame2.setSize(300, 300);
frame2.setVisible(true);
Timer timer = new Timer(5000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
JDialog dialog = new JDialog(frame1, " Dialog " , true);
dialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
dialog.setSize(100, 100);
dialog.setVisible(true);
}
});
timer.setRepeats(false);
timer.start();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
When the dialog is set to visible, call the toFront method on the parent JFrame.
java version " 1.7.0_21 "
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.8.3 Build version: 12D78
Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
In an application with multiple JFrames visible if a modal dialog is created with an owner that is under another JFrame, when the modal dialog is set as visible it is also displayed under the non-owner JFrame.
The provided example works as expected in the following environments:
- Mac OS X 10.8.4 with Java 1.6.0_45
- Windows 7 with Java 1.6.0_45
- Windows 7 with Java 1.7.0_21
The behaviour is different in:
- Mac OS X 10.8.4 with Java 1.7.0_21
REGRESSION. Last worked in version 6u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create two JFrames, " main " and " secondary "
2. Set the " main " JFrame visible, followed by the " secondary "
3. Create a modal JDialog with the " main " JFrame as the owner
4. Make the new JDialog visible
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The owner JFrame is displayed " on top " of the secondary JFrame and the modal dialog on top of it's owner
ACTUAL -
The modal dialog is displayed behind the secondary JFrame
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class FrameTester {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final JFrame frame1 = new JFrame( " Main Frame " );
frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame1.setSize(300, 300);
frame1.setVisible(true);
JFrame frame2 = new JFrame( " Second Frame " );
frame2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame2.setSize(300, 300);
frame2.setVisible(true);
Timer timer = new Timer(5000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
JDialog dialog = new JDialog(frame1, " Dialog " , true);
dialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
dialog.setSize(100, 100);
dialog.setVisible(true);
}
});
timer.setRepeats(false);
timer.start();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
When the dialog is set to visible, call the toFront method on the parent JFrame.