java.awt.event
Class InvocationEvent

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject 
      extended by java.awt.AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent 
          extended by java.awt.event.InvocationEvent
All Implemented Interfaces:
ActiveEvent sample code for java.awt.ActiveEvent definition code for java.awt.ActiveEvent , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public class InvocationEvent
extends AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent
implements ActiveEvent sample code for java.awt.ActiveEvent definition code for java.awt.ActiveEvent

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 reference 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.

Since:
1.2
See Also:
ActiveEvent sample code for java.awt.ActiveEvent definition code for java.awt.ActiveEvent , EventQueue.invokeLater(java.lang.Runnable) sample code for java.awt.EventQueue.invokeLater(java.lang.Runnable) definition code for java.awt.EventQueue.invokeLater(java.lang.Runnable) , EventQueue.invokeAndWait(java.lang.Runnable) sample code for java.awt.EventQueue.invokeAndWait(java.lang.Runnable) definition code for java.awt.EventQueue.invokeAndWait(java.lang.Runnable) , AWTEventListener sample code for java.awt.event.AWTEventListener definition code for java.awt.event.AWTEventListener , Serialized Form

Field Summary
protected  boolean catchExceptions sample code for java.awt.event.InvocationEvent.catchExceptions definition code for java.awt.event.InvocationEvent.catchExceptions
          Set to true if dispatch() catches Throwable and stores it in the exception instance variable.
static int INVOCATION_DEFAULT sample code for java.awt.event.InvocationEvent.INVOCATION_DEFAULT definition code for java.awt.event.InvocationEvent.INVOCATION_DEFAULT
          The default id for all InvocationEvents.
static int INVOCATION_FIRST sample code for java.awt.event.InvocationEvent.INVOCATION_FIRST definition code for java.awt.event.InvocationEvent.INVOCATION_FIRST
          Marks the first integer id for the range of invocation event ids.
static int INVOCATION_LAST sample code for java.awt.event.InvocationEvent.INVOCATION_LAST definition code for java.awt.event.InvocationEvent.INVOCATION_LAST
          Marks the last integer id for the range of invocation event ids.
protected  Object sample code for java.lang.Object definition code for java.lang.Object notifier sample code for java.awt.event.InvocationEvent.notifier definition code for java.awt.event.InvocationEvent.notifier
          The (potentially null) Object whose notifyAll() method will be called immediately after the Runnable.run() method returns.
protected  Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable runnable sample code for java.awt.event.InvocationEvent.runnable definition code for java.awt.event.InvocationEvent.runnable
          The Runnable whose run() method will be called.
 
Fields inherited from class java.awt.AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent
ACTION_EVENT_MASK sample code for java.awt.AWTEvent.ACTION_EVENT_MASK definition code for java.awt.AWTEvent.ACTION_EVENT_MASK , ADJUSTMENT_EVENT_MASK sample code for java.awt.AWTEvent.ADJUSTMENT_EVENT_MASK definition code for java.awt.AWTEvent.ADJUSTMENT_EVENT_MASK , COMPONENT_EVENT_MASK sample code for java.awt.AWTEvent.COMPONENT_EVENT_MASK definition code for java.awt.AWTEvent.COMPONENT_EVENT_MASK , consumed sample code for java.awt.AWTEvent.consumed definition code for java.awt.AWTEvent.consumed , CONTAINER_EVENT_MASK sample code for java.awt.AWTEvent.CONTAINER_EVENT_MASK definition code for java.awt.AWTEvent.CONTAINER_EVENT_MASK , FOCUS_EVENT_MASK sample code for java.awt.AWTEvent.FOCUS_EVENT_MASK definition code for java.awt.AWTEvent.FOCUS_EVENT_MASK , HIERARCHY_BOUNDS_EVENT_MASK sample code for java.awt.AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK definition code for java.awt.AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK , HIERARCHY_EVENT_MASK sample code for java.awt.AWTEvent.HIERARCHY_EVENT_MASK definition code for java.awt.AWTEvent.HIERARCHY_EVENT_MASK , id sample code for java.awt.AWTEvent.id definition code for java.awt.AWTEvent.id , INPUT_METHOD_EVENT_MASK sample code for java.awt.AWTEvent.INPUT_METHOD_EVENT_MASK definition code for java.awt.AWTEvent.INPUT_METHOD_EVENT_MASK , INVOCATION_EVENT_MASK sample code for java.awt.AWTEvent.INVOCATION_EVENT_MASK definition code for java.awt.AWTEvent.INVOCATION_EVENT_MASK , ITEM_EVENT_MASK sample code for java.awt.AWTEvent.ITEM_EVENT_MASK definition code for java.awt.AWTEvent.ITEM_EVENT_MASK , KEY_EVENT_MASK sample code for java.awt.AWTEvent.KEY_EVENT_MASK definition code for java.awt.AWTEvent.KEY_EVENT_MASK , MOUSE_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_EVENT_MASK definition code for java.awt.AWTEvent.MOUSE_EVENT_MASK , MOUSE_MOTION_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_MOTION_EVENT_MASK definition code for java.awt.AWTEvent.MOUSE_MOTION_EVENT_MASK , MOUSE_WHEEL_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_WHEEL_EVENT_MASK definition code for java.awt.AWTEvent.MOUSE_WHEEL_EVENT_MASK , PAINT_EVENT_MASK sample code for java.awt.AWTEvent.PAINT_EVENT_MASK definition code for java.awt.AWTEvent.PAINT_EVENT_MASK , RESERVED_ID_MAX sample code for java.awt.AWTEvent.RESERVED_ID_MAX definition code for java.awt.AWTEvent.RESERVED_ID_MAX , TEXT_EVENT_MASK sample code for java.awt.AWTEvent.TEXT_EVENT_MASK definition code for java.awt.AWTEvent.TEXT_EVENT_MASK , WINDOW_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_EVENT_MASK definition code for java.awt.AWTEvent.WINDOW_EVENT_MASK , WINDOW_FOCUS_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_FOCUS_EVENT_MASK definition code for java.awt.AWTEvent.WINDOW_FOCUS_EVENT_MASK , WINDOW_STATE_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_STATE_EVENT_MASK definition code for java.awt.AWTEvent.WINDOW_STATE_EVENT_MASK
 
Fields inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
source sample code for java.util.EventObject.source definition code for java.util.EventObject.source
 
Constructor Summary
protected InvocationEvent sample code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, int, java.lang.Runnable, java.lang.Object, boolean) definition code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, int, java.lang.Runnable, java.lang.Object, boolean) (Object sample code for java.lang.Object definition code for java.lang.Object  source, int id, Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  runnable, Object sample code for java.lang.Object definition code for java.lang.Object  notifier, boolean catchThrowables)
          Constructs an InvocationEvent with the specified source and ID which will execute the runnable's run method when dispatched.
  InvocationEvent sample code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, java.lang.Runnable) definition code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, java.lang.Runnable) (Object sample code for java.lang.Object definition code for java.lang.Object  source, Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  runnable)
          Constructs an InvocationEvent with the specified source which will execute the runnable's run method when dispatched.
  InvocationEvent sample code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, java.lang.Runnable, java.lang.Object, boolean) definition code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, java.lang.Runnable, java.lang.Object, boolean) (Object sample code for java.lang.Object definition code for java.lang.Object  source, Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  runnable, Object sample code for java.lang.Object definition code for java.lang.Object  notifier, boolean catchThrowables)
          Constructs an InvocationEvent with the specified source which will execute the runnable's run method when dispatched.
 
Method Summary
 void dispatch sample code for java.awt.event.InvocationEvent.dispatch() definition code for java.awt.event.InvocationEvent.dispatch() ()
          Executes the Runnable's run() method and notifies the notifier (if any) when run() returns.
 Exception sample code for java.lang.Exception definition code for java.lang.Exception getException sample code for java.awt.event.InvocationEvent.getException() definition code for java.awt.event.InvocationEvent.getException() ()
          Returns any Exception caught while executing the Runnable's run() method.
 Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable getThrowable sample code for java.awt.event.InvocationEvent.getThrowable() definition code for java.awt.event.InvocationEvent.getThrowable() ()
          Returns any Throwable caught while executing the Runnable's run() method.
 long getWhen sample code for java.awt.event.InvocationEvent.getWhen() definition code for java.awt.event.InvocationEvent.getWhen() ()
          Returns the timestamp of when this event occurred.
 String sample code for java.lang.String definition code for java.lang.String paramString sample code for java.awt.event.InvocationEvent.paramString() definition code for java.awt.event.InvocationEvent.paramString() ()
          Returns a parameter string identifying this event.
 
Methods inherited from class java.awt.AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent
consume sample code for java.awt.AWTEvent.consume() definition code for java.awt.AWTEvent.consume() , getID sample code for java.awt.AWTEvent.getID() definition code for java.awt.AWTEvent.getID() , isConsumed sample code for java.awt.AWTEvent.isConsumed() definition code for java.awt.AWTEvent.isConsumed() , setSource sample code for java.awt.AWTEvent.setSource(java.lang.Object) definition code for java.awt.AWTEvent.setSource(java.lang.Object) , toString sample code for java.awt.AWTEvent.toString() definition code for java.awt.AWTEvent.toString()
 
Methods inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
getSource sample code for java.util.EventObject.getSource() definition code for java.util.EventObject.getSource()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

INVOCATION_FIRST sample code for java.awt.event.InvocationEvent.INVOCATION_FIRST

public static final int INVOCATION_FIRST
Marks the first integer id for the range of invocation event ids.

See Also:
Constant Field Values

INVOCATION_DEFAULT sample code for java.awt.event.InvocationEvent.INVOCATION_DEFAULT

public static final int INVOCATION_DEFAULT
The default id for all InvocationEvents.

See Also:
Constant Field Values

INVOCATION_LAST sample code for java.awt.event.InvocationEvent.INVOCATION_LAST

public static final int INVOCATION_LAST
Marks the last integer id for the range of invocation event ids.

See Also:
Constant Field Values

runnable sample code for java.awt.event.InvocationEvent.runnable

protected Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  runnable
The Runnable whose run() method will be called.


notifier sample code for java.awt.event.InvocationEvent.notifier

protected Object sample code for java.lang.Object definition code for java.lang.Object  notifier
The (potentially null) Object whose notifyAll() method will be called immediately after the Runnable.run() method returns.


catchExceptions sample code for java.awt.event.InvocationEvent.catchExceptions

protected boolean catchExceptions
Set to true if dispatch() catches Throwable and stores it in the exception instance variable. If false, Throwables are propagated up to the EventDispatchThread's dispatch loop.

Constructor Detail

InvocationEvent sample code for java.awt.event.InvocationEvent(java.lang.Object, java.lang.Runnable) definition code for java.awt.event.InvocationEvent(java.lang.Object, java.lang.Runnable)

public InvocationEvent(Object sample code for java.lang.Object definition code for java.lang.Object  source,
                       Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  runnable)
Constructs an InvocationEvent with the specified source which will execute the runnable's run method when dispatched.

This is a convenience constructor. An invocation of the form InvocationEvent(source, runnable) behaves in exactly the same way as the invocation of InvocationEvent sample code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, java.lang.Runnable, java.lang.Object, boolean) definition code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, java.lang.Runnable, java.lang.Object, boolean) (source, runnable, null, false).

This method throws an IllegalArgumentException if source is null.

Parameters:
source - the Object that originated the event
runnable - the Runnable whose run method will be executed
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if source is null
See Also:
InvocationEvent(Object, Runnable, Object, boolean) sample code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, java.lang.Runnable, java.lang.Object, boolean) definition code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, java.lang.Runnable, java.lang.Object, boolean)

InvocationEvent sample code for java.awt.event.InvocationEvent(java.lang.Object, java.lang.Runnable, java.lang.Object, boolean) definition code for java.awt.event.InvocationEvent(java.lang.Object, java.lang.Runnable, java.lang.Object, boolean)

public InvocationEvent(Object sample code for java.lang.Object definition code for java.lang.Object  source,
                       Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  runnable,
                       Object sample code for java.lang.Object definition code for java.lang.Object  notifier,
                       boolean catchThrowables)
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.

An invocation of the form InvocationEvent(source, runnable, notifier, catchThrowables) behaves in exactly the same way as the invocation of InvocationEvent sample code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, int, java.lang.Runnable, java.lang.Object, boolean) definition code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, int, java.lang.Runnable, java.lang.Object, boolean) (source, InvocationEvent.INVOCATION_DEFAULT, runnable, notifier, catchThrowables).

This method throws an IllegalArgumentException if source is null.

Parameters:
source - the Object that originated the event
runnable - the Runnable whose run method will be executed
notifier - the Object whose notifyAll method will be called after Runnable.run has returned
catchThrowables - specifies whether dispatch should catch Throwable when executing the Runnable's run method, or should instead propagate those Throwables to the EventDispatchThread's dispatch loop
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if source is null
See Also:
InvocationEvent(Object, int, Runnable, Object, boolean) sample code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, int, java.lang.Runnable, java.lang.Object, boolean) definition code for java.awt.event.InvocationEvent.InvocationEvent(java.lang.Object, int, java.lang.Runnable, java.lang.Object, boolean)

InvocationEvent sample code for java.awt.event.InvocationEvent(java.lang.Object, int, java.lang.Runnable, java.lang.Object, boolean) definition code for java.awt.event.InvocationEvent(java.lang.Object, int, java.lang.Runnable, java.lang.Object, boolean)

protected InvocationEvent(Object sample code for java.lang.Object definition code for java.lang.Object  source,
                          int id,
                          Runnable sample code for java.lang.Runnable definition code for java.lang.Runnable  runnable,
                          Object sample code for java.lang.Object definition code for java.lang.Object  notifier,
                          boolean catchThrowables)
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.

Note that passing in an invalid id results in unspecified behavior. This method throws an IllegalArgumentException if source is null.

Parameters:
source - the Object that originated the event
id - the ID for the event
runnable - the Runnable whose run method will be executed
notifier - the Object whose notifyAll method will be called after Runnable.run has returned
catchThrowables - specifies whether dispatch should catch Throwable when executing the Runnable's run method, or should instead propagate those Throwables to the EventDispatchThread's dispatch loop
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if source is null
Method Detail

dispatch sample code for java.awt.event.InvocationEvent.dispatch() definition code for java.awt.event.InvocationEvent.dispatch()

public void dispatch()
Executes the Runnable's run() method and notifies the notifier (if any) when run() returns.

Specified by:
dispatch sample code for java.awt.ActiveEvent.dispatch() definition code for java.awt.ActiveEvent.dispatch() in interface ActiveEvent sample code for java.awt.ActiveEvent definition code for java.awt.ActiveEvent

getException sample code for java.awt.event.InvocationEvent.getException() definition code for java.awt.event.InvocationEvent.getException()

public Exception sample code for java.lang.Exception definition code for java.lang.Exception  getException()
Returns any Exception caught while executing the Runnable's run() method.

Returns:
A reference to the Exception if one was thrown; null if no Exception was thrown or if this InvocationEvent does not catch exceptions

getThrowable sample code for java.awt.event.InvocationEvent.getThrowable() definition code for java.awt.event.InvocationEvent.getThrowable()

public Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  getThrowable()
Returns any Throwable caught while executing the Runnable's run() method.

Returns:
A reference to the Throwable if one was thrown; null if no Throwable was thrown or if this InvocationEvent does not catch Throwables

getWhen sample code for java.awt.event.InvocationEvent.getWhen() definition code for java.awt.event.InvocationEvent.getWhen()

public long getWhen()
Returns the timestamp of when this event occurred.

Returns:
this event's timestamp
Since:
1.4

paramString sample code for java.awt.event.InvocationEvent.paramString() definition code for java.awt.event.InvocationEvent.paramString()

public String sample code for java.lang.String definition code for java.lang.String  paramString()
Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.

Overrides:
paramString sample code for java.awt.AWTEvent.paramString() definition code for java.awt.AWTEvent.paramString() in class AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent
Returns:
A string identifying the event and its attributes