Re: Please help: Exception in thread "Thread-3" java.lang.NullPointerException
- From: "Bart Cremers" <bcremers@xxxxxxxxx>
- Date: 27 Feb 2006 03:25:01 -0800
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
.
- References:
- Prev by Date: Re: Not sure why runs but does not display I think my thread
- Next by Date: Java Component Scheduling
- Previous by thread: Re: Please help: Exception in thread "Thread-3" java.lang.NullPointerException
- Next by thread: Java application write to http online
- Index(es):
Relevant Pages
|