T
- the type of the result of the requestpublic abstract class GuiRequest<T>
extends java.lang.Object
GuiRequest
or a GuiJob
(if you do not need to request data) to perform thread-safe
tasks in the graphical user interface (in a safe way from a worker thread).final String text = EDT.execute(new GuiRequest("getText") { protected String execute() throws Throwable { return guiComponent.getText(); } });
EDT
Modifier and Type | Field and Description |
---|---|
protected boolean |
hasResult
flag that indicates whether this action has a result meaning that the execution must wait until the action is done
|
protected java.lang.String |
name
the name of the action or
null |
Constructor and Description |
---|
GuiRequest()
Creates a new GUI request.
|
GuiRequest(java.lang.String name)
Creates a new GUI request.
|
protected final java.lang.String name
null
protected final boolean hasResult
public GuiRequest()
public GuiRequest(java.lang.String name)
name
- the name of the request or null
(the name is used to annotate exceptions that occur during the performance so it makes it a bit easier to allocate the point of failure)protected final T perform() throws java.lang.Throwable
java.lang.Throwable
- RuntimeException
, AWTException
, ...) and errors (like AWTError
, ...) that are occurred during the performanceprotected abstract T execute() throws java.lang.Throwable
null
java.lang.Throwable
- public final void run()
run
in interface java.lang.Runnable