Hey, I have this applet that starts as soon as the page is loaded. but i wanted it so you have to click the applet before it starts(getting keyboard focus) or else its just a race to click the applet before you die... so i tryed the following:
Code:
public class Whatever implements Runnable,KeyListener,MouseListener{
...
Graphics begin;
Thread th;
...
public void init(){
...
begin.drawString("click to start",100,50);
addMouseListener(this);
}
...
public void mousePressed(MouseEvent e){
begin.dispose();
th.start();
}
and i got a NullPointerException... whatever that is. so everything else works fine.
could anyone tell me a better way to go about this or a way to fix it?
thanks