FACTOID # 147: France is the top destination in the world for tourists, accounting for 11 percent of all tourist arrivals worldwide.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Event dispatching thread

The event dispatching thread (EDT) is a background thread used in Java to process events from the Abstract Windowing Toolkit (AWT) graphical user interface event queue. These events are primarily update events that cause user interface components to redraw themselves, or input events from input devices such as the mouse or keyboard. The AWT uses a single-threaded painting model in which all screen updates must be performed from a single thread. The event dispatching thread is the only valid thread to update the visual state of visible user interface components. Updating visible components from other threads is the source of many common bugs in Java programs that use Swing. A thread in computer science is short for a thread of execution. ... Java is an object-oriented programming language developed by Sun Microsystems in the early 1990s. ... The Abstract Windowing Toolkit (AWT) is Javas platform_independent windowing, graphics, and user_interface widget toolkit. ... PUI redirects here. ... An event queue is a software queue that is used to process a sequence of inputs, typically from the user. ... Software component representations: above the representation used in UML, below the representation commonly used by Microsofts COM objects. ... A number of devices, called input devices, are used for entering data into a machine, typically a computer. ... An abstract model (or conceptual model) is a theoretical construct that represents physical, biological or social processes, with a set of variables and a set of logical and quantitative relationships between them. ... A software bug is an error, flaw, mistake, failure, or fault in a computer program that prevents it from behaving as intended (e. ... A computer program is a collection of instructions that describe a task, or set of tasks, to be carried out by a computer. ... Example Swing widgets in Java 5. ...


Executing code in the EDT

Other application threads can execute code in the event dispatching thread by defining the code in a Runnable object and pass it to the SwingUtilities helper class or to the EventQueue. Two methods of these classes allow synchronous (SwingUtilities.invokeAndWait(Runnable) or EventQueue.invokeAndWait(Runnable)) and asynchronous (SwingUtilities.invokeLater(Runnable) or EventQueue.invokeLater(Runnable)) code execution from the EDT. The method invokeAndWait() should never be called from the event dispatching thread—it will throw an exception. The method SwingUtilities.isEventDispatchThread() or EventQueue.isEventDispatchThread() can be called to determine if the current thread is the event dispatching thread. Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of some condition that changes the normal flow of execution. ...


Another solution for executing code in the EDT is using the worker design pattern. The SwingWorker class, developed by Sun Microsystems, is an implementation of the worker design pattern, and as Java 6 is part of standard Swing distribution. The open source project Foxtrot provides another synchronous execution solution similar to SwingWorker. SwingWorker is a popular utility class developed by Sun Microsystems for the Swing library of the Java programming language. ... Sun Microsystems, Inc. ...


See also

The Abstract Windowing Toolkit (AWT) is Javas platform_independent windowing, graphics, and user_interface widget toolkit. ... Example Swing widgets in Java 5. ...

External links


  Results from FactBites:
 
The Last Word in Swing Threads (2425 words)
Swing components will generally not comply with the single-thread rule unless all their events are sent and received on the event-dispatch thread.
For example, property-change events should be sent on the event-dispatch thread, and model-change events should be received on the event-dispatch thread.
Background threads may use these methods to prompt the user for input on the event-dispatch thread and return the result to the background thread.
  More results at FactBites »


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m