I saw this on Marcus's board and I find it interesting. Does anyone know why it doesn't work?
Hi, I have a GUI program that needs to be halted at times. So I have a inner class called Hold.
class Hold extends Thread{//1
Hold(){//2
System.out.println("in Hold...");
start();
}//*2
public void run(){//3
while(halt){//4
try{//5
System.out.println("in run...");
sleep(1000);
}//*5
catch(Exception error){//6
}//*6
}//4
}//3
}//*1
And I use it to halt like this:
Hold holdRightHere = new Hold();
Is that right? "halt" is a class boolean variable. Obviously not since it didn't work for me!
But whats the problem?