some Function()
{
for(xxxxxx){
//a infinite loop or just a long code loading an running stuff from a list
}
}
ActionListener Panic(yyyyyyyy)
{
Stops the infinite loop by list.clear() or insert some thing into the list and break the loop
}
I is trying to make a panic button to stop my code, problem is when Java is running some thing all the actionListener gets queued up and fires after my big for loop finish its stuff. This is probably a silly question but i can't seem to fig out. Only solution i can think of is making this a thread( kinda hard and not sure if it will work ) or give a pop up message ask if user want to continue every cycle( too much prompt ). Just want to have a Red button that either break the loop and destroy the program much like Ctrl Z in linux and red stop button in eclipse or the Cancel button that stops your file transfer.
Thanks for looking =D Lots and Lots of thanks
Oh btw, if the solution is Thread, please put it in the example i have above. I has almost no idea how to write a thread =(