hello, im trying to run this function on one of my java forms every second that the program is running, so i placed a timer in a thread, however i keep getting a null pointer exception?!
code:
Code:
public void checkEvents() {
( new Thread() {
public void run() {
while( true ) {
if( runClock == true ) {
timer.schedule( new task(), 1000 );
}
}
}
}).start();
}
class task extends TimerTask {
public void run() {
print( "hello there" );
runClock = true;
timer.cancel();
}
};
cheers, trscookie.