文档

Java™ 教程-Java Tutorials 中文版
Trail: Creating a GUI With JFC/Swing

问题和练习:Swing 中的并发性

问题

  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.

练习

  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.

检查一下你的答案。


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