Can any one help me in solving this:
On click of PREV button it should pass command continuosly upto 1000 times or until end button is clicked.
When prev process going on, end button click is not recognising.
Here is the code...
public void run() {

super.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e){
while(true)
{
switch (command)
{
case DRCCommandButton.PREV: command=PREV;
EndButton.setEnabled(true);
prev();
break;
case DRCCommandButton.END: command= END;
end();
return;
default:drcConnection.sendDRCCode(command);
}//switch
command = PREV;
}//while
}});
}

public void prev(){
super.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
System.out.println("new");
if (command==4) end();

}
});

System.out.println("PREV :"+prevcount++);

try {
System.out.println("Sleep");
Thread.sleep(10000);
}
catch (InterruptedException e1) {
e1.printStackTrace();}
drcConnection.sendDRCCode(37);

//prevcount=0;
}


public void end(){
System.out.println("Ending...");
prevcount=MAX;
//thread.stop();
}