-
Backport
-
Resolution: Fixed
-
P3
-
None
-
5.0
-
b118
-
Not verified
The test iterates over sets of data, in particular - various GraphicsConfigurations.
The following example fails on 6u5 (but passes on 6u10b13), both WinXP and Vista:
import javax.swing.*;
import java.awt.*;
import java.util.*;
public class TheBug {
public static void main(String[] args) {
Dialog parent = new Dialog((Frame) null);
for (GraphicsConfiguration gc : getGCs()) {
JDialog dialog = new JDialog(parent, "", false, gc);
if (gc == null) {
Window owner = dialog.getOwner();
GraphicsConfiguration expected = owner.getGraphicsConfiguration();
GraphicsConfiguration actual = dialog.getGraphicsConfiguration();
/** quote from JDialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc) {
* If <code>gc</code> is <code>null</code>, the same
* <code>GraphicsConfiguration</code> as the owning Dialog is used.
*/
if (expected != actual) {
throw new RuntimeException("Not same. Expected: " + expected + ", actual: " + actual);
}
}
}
}
public static ArrayList<GraphicsConfiguration> getGCs() {
ArrayList<GraphicsConfiguration> result = new ArrayList<GraphicsConfiguration>();
result.add(null);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = ge.getScreenDevices();
for (GraphicsDevice device : devices) {
GraphicsConfiguration[] gcs = device.getConfigurations();
result.addAll(Arrays.asList(gcs));
}
return result;
}
}
The message is like this:
Not same. Expected: sun.awt.Win32GraphicsConfig@1270b73[dev=Win32GraphicsDevice[screen=0],pixfmt=0], actual: sun.awt.Win32GraphicsConfig@156ee8e[dev=Win32GraphicsDevice[screen=0],pixfmt=1]
The following example fails on 6u5 (but passes on 6u10b13), both WinXP and Vista:
import javax.swing.*;
import java.awt.*;
import java.util.*;
public class TheBug {
public static void main(String[] args) {
Dialog parent = new Dialog((Frame) null);
for (GraphicsConfiguration gc : getGCs()) {
JDialog dialog = new JDialog(parent, "", false, gc);
if (gc == null) {
Window owner = dialog.getOwner();
GraphicsConfiguration expected = owner.getGraphicsConfiguration();
GraphicsConfiguration actual = dialog.getGraphicsConfiguration();
/** quote from JDialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc) {
* If <code>gc</code> is <code>null</code>, the same
* <code>GraphicsConfiguration</code> as the owning Dialog is used.
*/
if (expected != actual) {
throw new RuntimeException("Not same. Expected: " + expected + ", actual: " + actual);
}
}
}
}
public static ArrayList<GraphicsConfiguration> getGCs() {
ArrayList<GraphicsConfiguration> result = new ArrayList<GraphicsConfiguration>();
result.add(null);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = ge.getScreenDevices();
for (GraphicsDevice device : devices) {
GraphicsConfiguration[] gcs = device.getConfigurations();
result.addAll(Arrays.asList(gcs));
}
return result;
}
}
The message is like this:
Not same. Expected: sun.awt.Win32GraphicsConfig@1270b73[dev=Win32GraphicsDevice[screen=0],pixfmt=0], actual: sun.awt.Win32GraphicsConfig@156ee8e[dev=Win32GraphicsDevice[screen=0],pixfmt=1]
- backport of
-
JDK-6659894 JDialog instance returns unexpected GraphicsConfiguration
-
- Closed
-