Re: Please help: Exception in thread "Thread-3" java.lang.NullPointerException



There are several issues with the code:

1. Don't override 'boolean mouseDown()' to handle mouse events. It's
deprecated and for sure doesn't generate an event on my system. Add a
mouselistener (in the init) to the applet instead on implement it's
'mouseClicked()' method.

2. It still generates a NullPointer, because starPoint is never
initialized. Initialize it in the init(): starPoint = new
Point(getWidth() / 2, getHeight() / 2);

3. The thread you is never started. Check you start() method

starThread = new Thread(this);
...
if (starThread == null) { // This can never be null, so start() is
never called on the thread.
starThread = new Thread(this, "Clock");
starThread.start();
}

Regards,

Bart

.



Relevant Pages

  • Re: hiding an interface (VB6)
    ... >I didn't notice a check in your Init() to see if it had already been ... >> the object when you initialize it, you could do something like the ... >> ByVal bData3 As Boolean) As Boolean ... >> Public Property Get Data1As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Atyfb questions and issues
    ... Then if the BIOS do the init, ... If it ends with 0x95, the chip has not been initialized, ... > otherwise I initialize it. ... clocked for DLLCLK and that kind of clocks, ...
    (Linux-Kernel)
  • Ruby Syntax: initialize versus init
    ... I've grown to love just how clear and concise ... the language is. ... Even in the Pickaxe book it points out that the spelling of 'initialize' as ... 'Init' seems simpler, to the point, and harder to mispell. ...
    (comp.lang.ruby)
  • Re: How to initialize class data?
    ... I've got some class data which I want to initialize once. ... The canonical way would be an INIT block. ... Foo is never instanciated. ...
    (comp.lang.perl.misc)