-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
1.4.0
-
x86
-
windows_98
On the windows system, the constructor for JWindow that accepts an owner window and a graphics configuration throws an IllegalArgumentException. The constructor works fine on solaris and linux. This can be seen from the following code :
import java.awt.*;
import javax.swing.*;
public class JWindowTest{
public static void main(String[] args){
JWindowTest jwn = new JWindowTest();
}
public JWindowTest(){
GraphicsConfiguration gc;
JFrame f = new JFrame("TEST");
JWindow parent = new JWindow(f);
JWindow child;
f.setSize(10,10);
f.setVisible(true);
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
GraphicsDevice gd = gs[0];
GraphicsConfiguration[] gcon = gd.getConfigurations();
gc = gcon[0];
System.out.println(gc);
child = new JWindow(parent , gc);
System.out.println("Done");
}
}
C:\work\temp>java -showversion JWindowTest
java version "1.4.0-beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta_refresh-b71)
Java HotSpot(TM) Client VM (build 1.4-internal, mixed mode)
Exception in thread "main" java.lang.IllegalArgumentException: null owner window
at java.awt.Window.ownedInit(Window.java:349)
at java.awt.Window.<init>(Window.java:344)
at javax.swing.JWindow.<init>(JWindow.java:197)
at JWindowTest.<init>(JWindowTest.java:27)
at JWindowTest.main(JWindowTest.java:6)
Please see the comments section where I have inadvertantly put the suggested fix
import java.awt.*;
import javax.swing.*;
public class JWindowTest{
public static void main(String[] args){
JWindowTest jwn = new JWindowTest();
}
public JWindowTest(){
GraphicsConfiguration gc;
JFrame f = new JFrame("TEST");
JWindow parent = new JWindow(f);
JWindow child;
f.setSize(10,10);
f.setVisible(true);
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
GraphicsDevice gd = gs[0];
GraphicsConfiguration[] gcon = gd.getConfigurations();
gc = gcon[0];
System.out.println(gc);
child = new JWindow(parent , gc);
System.out.println("Done");
}
}
C:\work\temp>java -showversion JWindowTest
java version "1.4.0-beta_refresh"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta_refresh-b71)
Java HotSpot(TM) Client VM (build 1.4-internal, mixed mode)
Exception in thread "main" java.lang.IllegalArgumentException: null owner window
at java.awt.Window.ownedInit(Window.java:349)
at java.awt.Window.<init>(Window.java:344)
at javax.swing.JWindow.<init>(JWindow.java:197)
at JWindowTest.<init>(JWindowTest.java:27)
at JWindowTest.main(JWindowTest.java:6)
Please see the comments section where I have inadvertantly put the suggested fix
- duplicates
-
JDK-4480578 JCK1.4, api/javax_swing/JWindow/index.html#Ctor2, merlin
- Closed