Hello all,
I'm just finishing up a simple gui program and I'm having a small problem.
The crux of my problem is this:
I have two buttons (which call corresponding methods):
Step: goes through a single iteration.
Run: runs through steps until other GUI intervention stops it.
Now, run has a while(true) situation and I want the run method to continue until the outside gui interaction. I have the action listeners and etc. all set up it's just when I click the run button I get 100% CPU and no GUI responsiveness. I'm assuming threads are the remedy to the problem but have little experience with them and would be grateful if somebody could suggest how the simple thread arrangement would be constructed.
[I guess in other words I'd like one thread to manage the GUI and buttons and one for the computation].
Many thanks for any help,
Wes
I'm just finishing up a simple gui program and I'm having a small problem.
The crux of my problem is this:
I have two buttons (which call corresponding methods):
Step: goes through a single iteration.
Run: runs through steps until other GUI intervention stops it.
Now, run has a while(true) situation and I want the run method to continue until the outside gui interaction. I have the action listeners and etc. all set up it's just when I click the run button I get 100% CPU and no GUI responsiveness. I'm assuming threads are the remedy to the problem but have little experience with them and would be grateful if somebody could suggest how the simple thread arrangement would be constructed.
[I guess in other words I'd like one thread to manage the GUI and buttons and one for the computation].
Many thanks for any help,
Wes