| java.awt.AWTEvent java.awt.event.InvocationEvent
All known Subclasses: sun.awt.PeerEvent,
InvocationEvent | public class InvocationEvent extends AWTEvent implements ActiveEvent(Code) | | An event which executes the run() method on a Runnable
when dispatched by the AWT event dispatcher thread. This class can
be used as a implementation of ActiveEvent rather
than declaring a new class and defining dispatch() .
Instances of this class are placed on the EventQueue by calls
to invokeLater and invokeAndWait . Client code
can use this fact to write replacement functions for invokeLater
and invokeAndWait without writing special-case code
in any AWTEventListener objects.
author: Fred Ecks author: David Mendenhall version: 1.16, 08/19/02 See Also: java.awt.ActiveEvent See Also: java.awt.EventQueue.invokeLater See Also: java.awt.EventQueue.invokeAndWait See Also: AWTEventListener since: 1.2 |
Field Summary | |
final public static int | INVOCATION_DEFAULT The default id for all InvocationEvents. | final public static int | INVOCATION_FIRST Marks the first integer id for the range of invocation event ids. | final public static int | INVOCATION_LAST Marks the last integer id for the range of invocation event ids. | protected boolean | catchExceptions Set to true if dispatch() catches Exception and stores it in the
exception instance variable. | protected Object | notifier The (potentially null) Object whose notifyAll() method will be called
immediately after the Runnable.run() method returns. | protected Runnable | runnable The Runnable whose run() method will be called. |
Constructor Summary | |
public | InvocationEvent(Object source, Runnable runnable) Constructs an InvocationEvent with the specified source which will
execute the runnable's run() method when dispatched. | public | InvocationEvent(Object source, Runnable runnable, Object notifier, boolean catchExceptions) Constructs an InvocationEvent with the specified source which will
execute the runnable's run() method when dispatched. | protected | InvocationEvent(Object source, int id, Runnable runnable, Object notifier, boolean catchExceptions) Constructs an InvocationEvent with the specified source and ID which
will execute the runnable's run() method when dispatched. |
Method Summary | |
public void | dispatch() Executes the Runnable's run() method and notifies the
notifier (if any) when run() returns. | public Exception | getException() Returns any Exception caught while executing the Runnable's run()
method. | public long | getWhen() | public String | paramString() Returns a parameter string identifying this event. |
INVOCATION_DEFAULT | final public static int INVOCATION_DEFAULT(Code) | | The default id for all InvocationEvents.
|
INVOCATION_FIRST | final public static int INVOCATION_FIRST(Code) | | Marks the first integer id for the range of invocation event ids.
|
INVOCATION_LAST | final public static int INVOCATION_LAST(Code) | | Marks the last integer id for the range of invocation event ids.
|
catchExceptions | protected boolean catchExceptions(Code) | | Set to true if dispatch() catches Exception and stores it in the
exception instance variable. If false, Exceptions are propagated up
to the EventDispatchThread's dispatch loop.
|
notifier | protected Object notifier(Code) | | The (potentially null) Object whose notifyAll() method will be called
immediately after the Runnable.run() method returns.
|
runnable | protected Runnable runnable(Code) | | The Runnable whose run() method will be called.
|
InvocationEvent | public InvocationEvent(Object source, Runnable runnable)(Code) | | Constructs an InvocationEvent with the specified source which will
execute the runnable's run() method when dispatched.
Parameters: source - the Object that originated the event Parameters: runnable - the Runnable whose run() method will be executed |
InvocationEvent | public InvocationEvent(Object source, Runnable runnable, Object notifier, boolean catchExceptions)(Code) | | Constructs an InvocationEvent with the specified source which will
execute the runnable's run() method when dispatched. If
notifier is non-null, notifyAll() will be called on it
immediately after run() returns.
Parameters: source - the Object that originated the event Parameters: runnable - the Runnable whose run() method will beexecuted Parameters: notifier - the Object whose notifyAll() method will becalled after Runnable.run() has returned Parameters: catchExceptions - specifies whether dispatch() should catchException when executing the Runnable's run()method, or should instead propagate thoseExceptions to the EventDispatchThread'sdispatch loop |
InvocationEvent | protected InvocationEvent(Object source, int id, Runnable runnable, Object notifier, boolean catchExceptions)(Code) | | Constructs an InvocationEvent with the specified source and ID which
will execute the runnable's run() method when dispatched.
If notifier is non-null, notifyAll() will be called on it
immediately after run() returns.
Parameters: source - the Object that originated the event Parameters: id - the ID for the Event Parameters: runnable - the Runnable whose run() method will beexecuted Parameters: notifier - the Object whose notifyAll() method will becalled after Runnable.run() has returned Parameters: catchExceptions - specifies whether dispatch() should catchException when executing the Runnable's run()method, or should instead propagate thoseExceptions to the EventDispatchThread'sdispatch loop |
dispatch | public void dispatch()(Code) | | Executes the Runnable's run() method and notifies the
notifier (if any) when run() returns.
|
getException | public Exception getException()(Code) | | Returns any Exception caught while executing the Runnable's run()
method.
A reference to the Exception if one was thrown; null if noException was thrown or if this InvocationEvent does notcatch exceptions |
getWhen | public long getWhen()(Code) | | |
paramString | public String paramString()(Code) | | Returns a parameter string identifying this event.
This method is useful for event-logging and for debugging.
A string identifying the event and its attributes |
|
|