http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html
先记上,以后添加。
event-dispatching thread:事件分发线程
event-dispatching
thread是一个执行绘画与事件处理代码的线程,比如paint和actionPerformed方法就会自动在event-dispatching
thread中被执行,当actionPerformed中执行流程被阻塞,paint会因为没有被执行而导致界面不刷新
http://java.sun.com/docs/books/tutorial/uiswing/concurrency/dispatch.html
Swing的事件处理代码是运行在事件分发线程(event-dispatching thread)之上的
为什么要这样,因为大部分Swing
对象方法是非线程安全的,如果以多线程方式去调用的话就会造成线程间的干涉与内存不一致错误
在事件分发线程中执行就像一个排队机,在上面
执行的代码就像一系列排队的任务(大部分任务都是调用事件处理方法,比如ActionListener.actionPerformed,其它任务就可以
通过invokeLater或invokeAndWait来安排),任务如果不很快结束的话,就会造成未处理的事件拥堵累积且用户界面也会变得没有响应
(事件分发线程也是负责处理GUI drawing的)
分享到:
相关推荐
Multithreadingincluding the java.util.concurrent library, locks, condition objects, futures, thread pools, thread-safe collections, threads and Swing Collection classescollections framework, ...
Specifically, you learn about threads in the contexts of Swing, JavaFX, and Java 8's Streams API. What you’ll learn How to do thread runnables, synchronization, volatility, waiting and notification...
Threads and Swing 794 Appendix 809 Index 813 Java 核心技术 卷2 Index Chapter 1: Streams and Files 1 Streams 2 Text Input and Output 11 Reading and Writing Binary Data 23 ZIP Archives...
Threads and Swing 794 ------------------------------------------------------ Core Java. Volume II. Advanced Features, 8th Edition ------------------------------------------------------ Author: Cay ...
9. **第9章:线程与Swing**(Threads and Swing) - Swing框架的单线程模型; - 如何在Swing应用程序中安全地更新UI; - 使用`SwingWorker`类处理后台任务。 10. **第10章:线程组**(Thread Groups) - 线程组...
书末附有两个附录,第一个附录提供了这些习题的答案,第二个附录则探究了Swing图形用户界面工具包中线程的使用情况以及它所涉及的线程相关API。 书中强调了正确使用Java线程API和并发工具的重要性,因为这不仅能...
4. **第9章:线程与Swing**(Threads and Swing) - **Swing特性**:概述Swing组件的特点及其线程安全性。 - **事件分发线程**(Event Dispatch Thread, EDT):解释EDT的作用及如何正确地更新UI。 - **异步任务...
New chapters cover thread performance, using threads with Swing, threads and Collection classes, thread pools, and threads and I/O (traditional, new, and interrupted). Developers who cannot yet ...
在Swing中,组件的外观可以通过LookAndFeel进行定制,可以实现Windows、Motif、Metal等不同风格,甚至可以创建自己的外观。此外,Swing还引入了模型-视图-控制器(MVC)设计模式,使得代码结构更加清晰,如JTable的...
In a few areas, we present complex programs that depend on knowledge of other Java features: AWT, Swing, NIO, and so on. However, the basic principles we present should be understandable by anyone ...
5. **可定制外观**:Swing允许开发者通过LookAndFeel API改变应用程序的视觉样式,可以设置为系统默认风格,也可以自定义皮肤。 6. **布局管理器**:Swing提供多种布局管理器,如FlowLayout、BorderLayout、...
You will also delve into more advanced topics like lambda expressions, closures, new i/o (NIO.2), enums, generics, XML, metadata and the Swing APIs for GUI design and development. By the end of the ...
You will also delve into more advanced topics like lambda expressions, closures, new i/o (NIO.2), enums, generics, XML, metadata and the Swing APIs for GUI design and development. By the end of the ...
The JLayer class has been added, which is a flexible and powerful decorator for Swing components; see How to Decorate Components with JLayer. The Nimbus Look and Feel has been moved from the ...
总结来说,"GUI-and-Thread-JAVA.zip"提供的资源涵盖了Java GUI编程和多线程管理这两个重要主题。通过深入学习DEMO_Threads.zip和DEMO_GUIs.zip中的示例,开发者可以增强自己在Java GUI设计和多线程编程方面的技能,...
Chapter 15 Swing Basics Chapter 16 Swinging Higher Chapter 17 Polymorphism Chapter 18 Annotations Chapter 19 Internationalization Chapter 20 Applets Chapter 21 Java Networking Chapter 22 Java Database...
模块17:JFC Swing and Advanced Swing Components(Swing和高级Swing组件),涵盖了Java中的Swing组件,包括JFrame类、JPanel类、JButton类等内容。 本资源是一个非常详细的Java教学课件,涵盖了Java编程语言的...
HTML in Swing Section 8.1. HTML on Components Section 8.2. JEditorPane Section 8.3. Parsing HTML Section 8.4. Cookies Chapter 9. Sockets for Clients Section 9.1. Socket Basics Section ...
Converting Between Characters and Numeric Codes Recipe 1.3. Testing Whether an Object Is String-like Recipe 1.4. Aligning Strings Recipe 1.5. Trimming Space from the Ends of a String Recipe ...
3. **Background Threads**: 为了不阻塞主应用程序线程,启动界面通常会在后台线程(如`Thread`或` SwingWorker`)上运行。这样可以确保用户界面保持响应,同时初始化过程在后台进行。 4. **Progress Bar**: 进度条...