public interface GUISynchronizer
Definition of an interface that supports updating GUI components from different threads.
Typical Java GUI libraries use a specific thread (e.g. event dispatch thread) that is alone responsible for updating GUI components. When working with multiple threads special care has to be taken if GUI components are to be accessed; it has to be ensured that such operations are only performed on the event dispatch thread.
This interface provides a generic way for such updates. It defines typical operations that deal with an event dispatch thread: to invoke a code block synchronously or asynchronously on this thread. Concrete, platform specific implementations have to use the appropriate means provided by the platform they encapsulate to ensure that this code gets executed on the event dispatch thread.
Modifier and Type | Method and Description |
---|---|
void |
asyncInvoke(Runnable runnable)
Invokes the given runnable object asynchronously on the event dispatch
thread.
|
boolean |
isEventDispatchThread()
Returns a flag whether the current thread is the event dispatch thread.
|
void |
syncInvoke(Runnable runnable)
Invokes the given runnable object synchronously on the event dispatch
thread.
|
void asyncInvoke(Runnable runnable)
runnable
- the code to be executed on the event dispatch threadvoid syncInvoke(Runnable runnable) throws GUIRuntimeException
runnable
- the code to be executed on the event dispatch threadGUIRuntimeException
- if an error occursboolean isEventDispatchThread()
Copyright © 2016 The JGUIraffe Team. All rights reserved.