If the SwingWorker atate is DONE, do this... How?
~Gotta love the typo :)~
I've got a lottery program running. You fill in 6 values and click "Play", a SwingWorker generates 6 random numbers and checks them against your picks. It also updates a counter showing basic stats. This behavior continues until you click "Stop". I should add, when you click "Play" every text box that was editable becomes not, and the "Done" button that was disabled becomes enabled. Hit "Done" and the converse. Everything works :).
This is for school, and I would like to implement a "Professor Mode". This mode will break the SwingWorker's DoInBackground() when there are at least 3 matches, sort of a debug to check if the program is working correctly. This part has been simple enough. Now, when the SwingWorker is done via the proffesor mode break, I want all of those non-editables to become editable.
I guess I could pass the buttons to the SwingWorker's constructor, but this seems a little ridiculous. I can get the state of the worker easy enough, but my main issue is that all of my program's functionality is in ActionPerformed(). Since there is no action with the auto-stop, I can't get the state.
Any ideas? Thanks.
Re: If the SwingWorker atate is DONE, do this... How?
One way to get the state is to add a PropertyChangeListener to the SwingWorker before excecuting it, and check with the state property is SwingWorker.StateValue.DONE.