Hi, 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 tried the following:
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.