Documentation

Trail: Creating a GUI With JFC/Swing

Questions and Exercises: Concurrency in Swing

Questions

  1. For each of the following tasks, specify which thread it should be executed in and why.
  2. 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.
  3. SwingWorker has two type parameters. Explain how these type parameters are used, and why it often doesn't matter what they are.

Exercises

  1. 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.


Previous page: Bound Properties and Status Methods
Next page: Using Other Swing Features