Updating swing components from an arbitrary thread

6854933580_2c8b688306_z

This means GUI is a shared data structure and some synchronization is needed to ensure that only one thread accesses it at a time.

Though AWT and Swing expose the (thread unsafe) methods to create and access the GUI components and these methods are visible to all application threads, likewise in other GUI frameworks, only a single, Event Dispatching thread has the right to execute these methods. Access to the GUI is serialized and other threads may submit some code to be executed in the EDT through a EDT message queue.

SVG (Scalable Vector Graphics) is an open-standard language for describing two-dimensional (2D) graphics in XML. SVG lets you describe rich images with features such as gradients, transparency, filter effects and animation.

A rich set of event handlers such as for mouse movement and clicks can be assigned to any SVG graphical object.

These handlers can invoke scripts, which, in response to an event, can dynamically modify the SVG graphic through the SVG Document Object Model (DOM) API, allowing, for example scripts to change the color or location of graphical elements.

Updating visible components from other threads is the source of many common bugs in Java programs that use Swing.

A software application normally consists of multiple threads and a single GUI data structure.

For example, you can print while editing or sending a fax.

You must have an account to comment. Please register or login here!