Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4482324

JWindow(owner,gc) throws IAE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.4.0
    • client-libs

      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

            svioletsunw Scott Violet (Inactive)
            kjethisunw Kanishk Jethi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: