View Single Post
  #1 (permalink)  
Old 08-05-2007, 05:02 PM
barney barney is offline
Member
 
Join Date: Jul 2007
Posts: 40
barney is on a distinguished road
ERROR: nullPointerException in applet
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:
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.
Reply With Quote
Sponsored Links