Questions and Exercises: Concurrency in Swing
Questions
- For each of the following tasks, specify which thread it should be executed in and why.
- One set of threads is not used for any of the tasks mentioned in the previous question. Name this thread and explain why its applications are so limited.
SwingWorker
has two type parameters. Explain how these type parameters are used, and why it often doesn't matter what they are.
Exercises
- Modify the
Flipper
example so that it pauses 5 seconds between "coin flips." If the user clicks the "Cancel", the coin-flipping loop terminates immediately.
Check your answers.