For Programmers: Free Programming Magazines  


Home > Archive > Java Help > March 2006 > Eclipse - NullPointerException for the simples possible applet









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Eclipse - NullPointerException for the simples possible applet
si

2006-03-22, 8:09 am

Hello

I've just started using Eclipse 3.2.1 and I've observed that every few
launches of the simples possible applet (see the code below) I get the
following error (it happens only when exitin applet viewer):

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException:
component argument pData
at sun.awt.windows.Win32SurfaceData.initOps(Native Method)
at sun.awt.windows.Win32SurfaceData.<init>(Win32SurfaceData.java:448)
at sun.awt.windows.Win32SurfaceData.createData(Win32SurfaceData.java:316)
at
sun.awt.Win32GraphicsConfig.createSurfaceData(Win32GraphicsConfig.java:357)
at
sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:332)
at
sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:313)
at sun.awt.windows.WComponentPeer$2.run(WComponentPeer.java:353)

The applet code looks like this:

import javax.swing.JApplet;

public class dummy extends JApplet {

/** Constructor */
public dummy() throws HeadlessException {
super();
// TODO Auto-generated constructor stub
}

}


Is this a bug or I'm doing something wrong?
Thanks
si
Patricia Shanahan

2006-03-22, 7:06 pm

si wrote:
....
> The applet code looks like this:
>
> import javax.swing.JApplet;
>
> public class dummy extends JApplet {
>
> /** Constructor */
> public dummy() throws HeadlessException {
> super();
> // TODO Auto-generated constructor stub
> }
>
> }
>
>
> Is this a bug or I'm doing something wrong?
> Thanks
> si


I changed the name, because I didn't want a class called just "dummy"
floating around in my test directory, and added an import for
java.awt.HeadlessException to get it to compile. The result ran:

import javax.swing.JApplet;
import java.awt.HeadlessException;

public class DummyApplet extends JApplet {

/** Constructor */
public DummyApplet() throws HeadlessException {
super();
// TODO Auto-generated constructor stub
}

}

Does this run on your system?

Patricia
si

2006-03-22, 7:06 pm


> I changed the name, because I didn't want a class called just "dummy"
> floating around in my test directory, and added an import for
> java.awt.HeadlessException to get it to compile. The result ran:
>
> import javax.swing.JApplet;
> import java.awt.HeadlessException;
>
> public class DummyApplet extends JApplet {
>
> /** Constructor */
> public DummyApplet() throws HeadlessException {
> super();
> // TODO Auto-generated constructor stub
> }
>
> }
>
> Does this run on your system?
>
> Patricia


Sorry, I forgot about the line with HeadlessException import.
I have it in my code but it crashes anyway.

I have two computers, both XP Pro SP2. The applet runs ok on one of them
(that is on the computer it was created) and crushes on the other one.
Maybe this is a metter of some project settings, I don't know.

si
Oliver Wong

2006-03-22, 7:06 pm


"si" <nomail@nonet.no> wrote in message news:dvreev$h4j$1@news.onet.pl...
> Hello
>
> I've just started using Eclipse 3.2.1 and I've observed that every few
> launches of the simples possible applet (see the code below) I get the
> following error (it happens only when exitin applet viewer):
>
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException:
> component argument pData
> at sun.awt.windows.Win32SurfaceData.initOps(Native Method)
> at sun.awt.windows.Win32SurfaceData.<init>(Win32SurfaceData.java:448)
> at sun.awt.windows.Win32SurfaceData.createData(Win32SurfaceData.java:316)
> at
> sun.awt.Win32GraphicsConfig.createSurfaceData(Win32GraphicsConfig.java:357)
> at
> sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:332)
> at
> sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:313)
> at sun.awt.windows.WComponentPeer$2.run(WComponentPeer.java:353)
>
> The applet code looks like this:
>
> import javax.swing.JApplet;
>
> public class dummy extends JApplet {
>
> /** Constructor */
> public dummy() throws HeadlessException {
> super();
> // TODO Auto-generated constructor stub
> }
>
> }
>
>
> Is this a bug or I'm doing something wrong?


It's a bug. See
http://bugs.sun.com/bugdatabase/vie...?bug_id=5062191

- Oliver

si

2006-03-23, 4:12 am

>
> It's a bug. See
> http://bugs.sun.com/bugdatabase/vie...?bug_id=5062191
>
> - Oliver


Thank you!
si
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com