The following, simple test program of the new no-argument Window() constructor
fails with an exception on Windows (it was either Windows 95 or 98--I didn't
try it on NT). It works fine on Solaris.
java -version
java version "1.3"
HotSpot Client VM (1.3beta, mixed mode, build l)
java WindowTest
Exception in thread "main" java.lang.NullPointerException: peer
at sun.awt.windows.WWindowPeer.createAwtWindow(Native Method)
at sun.awt.windows.WWindowPeer.create(WWindowPeer.java:112)
at sun.awt.windows.WComponentPeer.<init>(WComponentPeer.java:324)
at sun.awt.windows.WCanvasPeer.<init>(WCanvasPeer.java:30)
at sun.awt.windows.WPanelPeer.<init>(WPanelPeer.java:69)
at sun.awt.windows.WWindowPeer.<init>(WWindowPeer.java:90)
at sun.awt.windows.WToolkit.createWindow(WToolkit.java:221)
at java.awt.Window.addNotify(Window.java:304)
at java.awt.Window.show(Window.java:343)
at java.awt.Component.show(Component.java:917)
at java.awt.Component.setVisible(Component.java:875)
at WindowTest.main(WindowTest.java:9)
If you change the "new Window()" call to "new Window(new Frame())" it
works.
---------------------------------------------------------------------------
import java.awt.*;
public class WindowTest {
public static void main(String[] args) {
Window w = new Window();
w.setLocation(100, 100);
w.setSize(200, 200);
w.setVisible(true);
}
}
---------------------------------------------------------------------------