previous |
start
Pausing and Running the Animation
- Want to pause animation until "Run" or "Step" button is clicked
- Need to coordinate UI thread, animation thread
- Try to use built-in thread-safe construct in java.util.concurrent
- Trick: Use a blocking queue
- Button click adds string "Run" or "Step" to queue
- Animation thread calls take on the queue, blocks
if no string inserted
- Ch9/animation2/Sorter.java
- Ch9/animation2/AnimationTester.java
previous |
start