Overview
Package
Class
Use
Tree
Deprecated
Index
All Classes
Help
Prev Class
Next Class
Sample
Document
Class java.awt.event.InvocationEvent
Inherited members: ShowHide
Deprecated: ShowHide
View: ClientSubclassPackageImplementation
java.awt.event

Class InvocationEvent

  • java.lang.Object
    • java.util.EventObject
      • java.awt.AWTEvent
        • java.awt.event.InvocationEvent
  • All Implemented Interfaces:
    ActiveEvent, java.io.Serializable
    public class InvocationEvent extends AWTEvent implements 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.

    An unspecified behavior will be caused if the id parameter of any particular InvocationEvent instance is not in the range from INVOCATION_FIRST to INVOCATION_LAST.

    Since:
    1.2
    See Also:
    ActiveEvent, EventQueue.invokeLater(java.lang.Runnable), EventQueue.invokeAndWait(java.lang.Runnable), AWTEventListener, Serialized Form
    • Fields 
      Modifier and Type Field and Description
      Inherited member indicator ACTION_EVENT_MASK Reveal DetailHide Detail
      static long ACTION_EVENT_MASK
      The event mask for selecting action events.
      public static final long ACTION_EVENT_MASK
      The event mask for selecting action events.
      See Also:
      Constant Field Values
      Inherited member indicator ADJUSTMENT_EVENT_MASK Reveal DetailHide Detail
      static long ADJUSTMENT_EVENT_MASK
      The event mask for selecting adjustment events.
      public static final long ADJUSTMENT_EVENT_MASK
      The event mask for selecting adjustment events.
      See Also:
      Constant Field Values
      Ordinary member indicator catchExceptions Reveal DetailHide Detail
      protected boolean catchExceptions
      Set to true if dispatch() catches Throwable and stores it in the exception instance variable.
      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.
      Inherited member indicator COMPONENT_EVENT_MASK Reveal DetailHide Detail
      static long COMPONENT_EVENT_MASK
      The event mask for selecting component events.
      public static final long COMPONENT_EVENT_MASK
      The event mask for selecting component events.
      See Also:
      Constant Field Values
      Inherited member indicator consumed Reveal DetailHide Detail
      protected boolean consumed
      Controls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer; true means it's not.
      protected boolean consumed
      Controls whether or not the event is sent back down to the peer once the source has processed it - false means it's sent to the peer; true means it's not. Semantic events always have a 'true' value since they were generated by the peer in response to a low-level event.
      See Also:
      AWTEvent.consume(), AWTEvent.isConsumed()
      Inherited member indicator CONTAINER_EVENT_MASK Reveal DetailHide Detail
      static long CONTAINER_EVENT_MASK
      The event mask for selecting container events.
      public static final long CONTAINER_EVENT_MASK
      The event mask for selecting container events.
      See Also:
      Constant Field Values
      Inherited member indicator FOCUS_EVENT_MASK Reveal DetailHide Detail
      static long FOCUS_EVENT_MASK
      The event mask for selecting focus events.
      public static final long FOCUS_EVENT_MASK
      The event mask for selecting focus events.
      See Also:
      Constant Field Values
      Inherited member indicator HIERARCHY_BOUNDS_EVENT_MASK Reveal DetailHide Detail
      static long HIERARCHY_BOUNDS_EVENT_MASK
      The event mask for selecting hierarchy bounds events.
      public static final long HIERARCHY_BOUNDS_EVENT_MASK
      The event mask for selecting hierarchy bounds events.
      See Also:
      Constant Field Values
      Inherited member indicator HIERARCHY_EVENT_MASK Reveal DetailHide Detail
      static long HIERARCHY_EVENT_MASK
      The event mask for selecting hierarchy events.
      public static final long HIERARCHY_EVENT_MASK
      The event mask for selecting hierarchy events.
      See Also:
      Constant Field Values
      Inherited member indicator id Reveal DetailHide Detail
      protected int id
      The event's id.
      protected int id
      The event's id.
      See Also:
      AWTEvent.getID(), AWTEvent.AWTEvent(java.lang.Object, int)
      Inherited member indicator INPUT_METHOD_EVENT_MASK Reveal DetailHide Detail
      static long INPUT_METHOD_EVENT_MASK
      The event mask for selecting input method events.
      public static final long INPUT_METHOD_EVENT_MASK
      The event mask for selecting input method events.
      See Also:
      Constant Field Values
      Ordinary member indicator INVOCATION_DEFAULT Reveal DetailHide Detail
      static int INVOCATION_DEFAULT
      The default id for all InvocationEvents.
      public static final int INVOCATION_DEFAULT
      The default id for all InvocationEvents.
      See Also:
      Constant Field Values
      Inherited member indicator INVOCATION_EVENT_MASK Reveal DetailHide Detail
      static long INVOCATION_EVENT_MASK
      The event mask for selecting invocation events.
      public static final long INVOCATION_EVENT_MASK
      The event mask for selecting invocation events.
      See Also:
      Constant Field Values
      Ordinary member indicator INVOCATION_FIRST Reveal DetailHide Detail
      static int INVOCATION_FIRST
      Marks the first integer id for the range of invocation event ids.
      public static final int INVOCATION_FIRST
      Marks the first integer id for the range of invocation event ids.
      See Also:
      Constant Field Values
      Ordinary member indicator INVOCATION_LAST Reveal DetailHide Detail
      static int INVOCATION_LAST
      Marks the last integer id for the range of invocation event ids.
      public static final int INVOCATION_LAST
      Marks the last integer id for the range of invocation event ids.
      See Also:
      Constant Field Values
      Inherited member indicator ITEM_EVENT_MASK Reveal DetailHide Detail
      static long ITEM_EVENT_MASK
      The event mask for selecting item events.
      public static final long ITEM_EVENT_MASK
      The event mask for selecting item events.
      See Also:
      Constant Field Values
      Inherited member indicator KEY_EVENT_MASK Reveal DetailHide Detail
      static long KEY_EVENT_MASK
      The event mask for selecting key events.
      public static final long KEY_EVENT_MASK
      The event mask for selecting key events.
      See Also:
      Constant Field Values
      Inherited member indicator MOUSE_EVENT_MASK Reveal DetailHide Detail
      static long MOUSE_EVENT_MASK
      The event mask for selecting mouse events.
      public static final long MOUSE_EVENT_MASK
      The event mask for selecting mouse events.
      See Also:
      Constant Field Values
      Inherited member indicator MOUSE_MOTION_EVENT_MASK Reveal DetailHide Detail
      static long MOUSE_MOTION_EVENT_MASK
      The event mask for selecting mouse motion events.
      public static final long MOUSE_MOTION_EVENT_MASK
      The event mask for selecting mouse motion events.
      See Also:
      Constant Field Values
      Inherited member indicator MOUSE_WHEEL_EVENT_MASK Reveal DetailHide Detail
      static long MOUSE_WHEEL_EVENT_MASK
      The event mask for selecting mouse wheel events.
      public static final long MOUSE_WHEEL_EVENT_MASK
      The event mask for selecting mouse wheel events.
      Since:
      1.4
      See Also:
      Constant Field Values
      Ordinary member indicator notifier Reveal DetailHide Detail
      protected java.lang.Object notifier
      The (potentially null) Object whose notifyAll() method will be called immediately after the Runnable.run() method has returned or thrown an exception.
      protected java.lang.Object notifier
      The (potentially null) Object whose notifyAll() method will be called immediately after the Runnable.run() method has returned or thrown an exception.
      See Also:
      isDispatched()
      Inherited member indicator PAINT_EVENT_MASK Reveal DetailHide Detail
      static long PAINT_EVENT_MASK
      The event mask for selecting paint events.
      public static final long PAINT_EVENT_MASK
      The event mask for selecting paint events.
      See Also:
      Constant Field Values
      Inherited member indicator RESERVED_ID_MAX Reveal DetailHide Detail
      static int RESERVED_ID_MAX
      The maximum value for reserved AWT event IDs.
      public static final int RESERVED_ID_MAX
      The maximum value for reserved AWT event IDs. Programs defining their own event IDs should use IDs greater than this value.
      See Also:
      Constant Field Values
      Ordinary member indicator runnable Reveal DetailHide Detail
      protected java.lang.Runnable runnable
      The Runnable whose run() method will be called.
      protected java.lang.Runnable runnable
      The Runnable whose run() method will be called.
      Inherited member indicator source Reveal DetailHide Detail
      protected java.lang.Object source
      The object on which the Event initially occurred.
      protected transient java.lang.Object source
      The object on which the Event initially occurred.
      Inherited member indicator TEXT_EVENT_MASK Reveal DetailHide Detail
      static long TEXT_EVENT_MASK
      The event mask for selecting text events.
      public static final long TEXT_EVENT_MASK
      The event mask for selecting text events.
      See Also:
      Constant Field Values
      Inherited member indicator WINDOW_EVENT_MASK Reveal DetailHide Detail
      static long WINDOW_EVENT_MASK
      The event mask for selecting window events.
      public static final long WINDOW_EVENT_MASK
      The event mask for selecting window events.
      See Also:
      Constant Field Values
      Inherited member indicator WINDOW_FOCUS_EVENT_MASK Reveal DetailHide Detail
      static long WINDOW_FOCUS_EVENT_MASK
      The event mask for selecting window focus events.
      public static final long WINDOW_FOCUS_EVENT_MASK
      The event mask for selecting window focus events.
      Since:
      1.4
      See Also:
      Constant Field Values
      Inherited member indicator WINDOW_STATE_EVENT_MASK Reveal DetailHide Detail
      static long WINDOW_STATE_EVENT_MASK
      The event mask for selecting window state events.
      public static final long WINDOW_STATE_EVENT_MASK
      The event mask for selecting window state events.
      Since:
      1.4
      See Also:
      Constant Field Values
    • Constructors 
      Modifier Constructor and Description
      Ordinary member indicator InvocationEvent Reveal DetailHide Detail
      protected InvocationEvent(java.lang.Object source, int id, java.lang.Runnable runnable, 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.
      protected InvocationEvent(java.lang.Object source, int id, java.lang.Runnable runnable, 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 has returned or thrown an exception.

      This method throws an IllegalArgumentException if source is null.

      Parameters:
      source - The Object that originated the event
      id - An integer indicating the type of event. For information on allowable values, see the class description for InvocationEvent
      runnable - The Runnable whose run method will be executed
      notifier - The Object whose notifyAll method will be called after Runnable.run has returned or thrown an exception
      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:
      java.lang.IllegalArgumentException - if source is null
      See Also:
      EventObject.getSource(), AWTEvent.getID()
      Ordinary member indicator InvocationEvent Reveal DetailHide Detail
       InvocationEvent(java.lang.Object source, java.lang.Runnable runnable)
      Constructs an InvocationEvent with the specified source which will execute the runnable's run method when dispatched.
      public InvocationEvent(java.lang.Object source, 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(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:
      java.lang.IllegalArgumentException - if source is null
      See Also:
      EventObject.getSource(), InvocationEvent(Object, Runnable, Object, boolean)
      Ordinary member indicator InvocationEvent Reveal DetailHide Detail
       InvocationEvent(java.lang.Object source, java.lang.Runnable runnable, java.lang.Object notifier, boolean catchThrowables)
      Constructs an InvocationEvent with the specified source which will execute the runnable's run method when dispatched.
      public InvocationEvent(java.lang.Object source, java.lang.Runnable runnable, 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 has returned or thrown an exception.

      An invocation of the form InvocationEvent(source, runnable, notifier, catchThrowables) behaves in exactly the same way as the invocation of InvocationEvent(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 or thrown an exception
      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:
      java.lang.IllegalArgumentException - if source is null
      See Also:
      EventObject.getSource(), InvocationEvent(Object, int, Runnable, Object, boolean)
    • Methods 
      Modifier and Type Method and Description
      Inherited member indicator consume Reveal DetailHide Detail
      protected void consume()
      Consumes this event, if this event can be consumed.
      protected void consume()
      Description copied from class: AWTEvent
      Consumes this event, if this event can be consumed. Only low-level, system events can be consumed
      Ordinary member indicator dispatch Reveal DetailHide Detail
      void dispatch()
      Executes the Runnable's run() method and notifies the notifier (if any) when run() has returned or thrown an exception.
      public void dispatch()
      Executes the Runnable's run() method and notifies the notifier (if any) when run() has returned or thrown an exception.
      Specified by:
      dispatch in interface ActiveEvent
      See Also:
      isDispatched()
      Ordinary member indicator getException Reveal DetailHide Detail
      java.lang.Exception getException()
      Returns any Exception caught while executing the Runnable's run() method.
      public 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
      Inherited member indicator getID Reveal DetailHide Detail
      int getID()
      Returns the event type.
      public int getID()
      Description copied from class: AWTEvent
      Returns the event type.
      Inherited member indicator getSource Reveal DetailHide Detail
      java.lang.Object getSource()
      The object on which the Event initially occurred.
      public java.lang.Object getSource()
      Description copied from class: java.util.EventObject
      The object on which the Event initially occurred.
      Returns:
      The object on which the Event initially occurred.
      Ordinary member indicator getThrowable Reveal DetailHide Detail
      java.lang.Throwable getThrowable()
      Returns any Throwable caught while executing the Runnable's run() method.
      public 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
      Since:
      1.5
      Ordinary member indicator getWhen Reveal DetailHide Detail
      long getWhen()
      Returns the timestamp of when this event occurred.
      public long getWhen()
      Returns the timestamp of when this event occurred.
      Returns:
      this event's timestamp
      Since:
      1.4
      Inherited member indicator isConsumed Reveal DetailHide Detail
      protected boolean isConsumed()
      Returns whether this event has been consumed.
      protected boolean isConsumed()
      Description copied from class: AWTEvent
      Returns whether this event has been consumed.
      Ordinary member indicator isDispatched Reveal DetailHide Detail
      boolean isDispatched()
      Returns true if the event is dispatched or any exception is thrown while dispatching, false otherwise.
      public boolean isDispatched()
      Returns true if the event is dispatched or any exception is thrown while dispatching, false otherwise. The method should be called by a waiting thread that calls the notifier.wait() method. Since spurious wakeups are possible (as explained in Object.wait()), this method should be used in a waiting loop to ensure that the event got dispatched:
           while (!event.isDispatched()) {
               notifier.wait();
           }
       
      If the waiting thread wakes up without dispatching the event, the isDispatched() method returns false, and the while loop executes once more, thus, causing the awakened thread to revert to the waiting mode.

      If the notifier.notifyAll() happens before the waiting thread enters the notifier.wait() method, the while loop ensures that the waiting thread will not enter the notifier.wait() method. Otherwise, there is no guarantee that the waiting thread will ever be woken from the wait.

      Returns:
      true if the event has been dispatched, or any exception has been thrown while dispatching, false otherwise
      Since:
      1.7
      See Also:
      dispatch(), notifier, catchExceptions
      Overridden member indicator paramString Reveal DetailHide Detail
      java.lang.String paramString()
      Returns a parameter string identifying this event.
      public java.lang.String paramString()
      Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.
      Overrides:
      paramString in class AWTEvent
      Returns:
      A string identifying the event and its attributes
      Inherited member indicator setSource Reveal DetailHide Detail
      void setSource(java.lang.Object newSource)
      Retargets an event to a new source.
      public void setSource(java.lang.Object newSource)
      Description copied from class: AWTEvent
      Retargets an event to a new source. This method is typically used to retarget an event to a lightweight child Component of the original heavyweight source.

      This method is intended to be used only by event targeting subsystems, such as client-defined KeyboardFocusManagers. It is not for general client use.

      Parameters:
      newSource - the new Object to which the event should be dispatched
      Since:
      1.4
      Inherited member indicator toString Reveal DetailHide Detail
      java.lang.String toString()
      Returns a String representation of this object.
      public java.lang.String toString()
      Description copied from class: AWTEvent
      Returns a String representation of this object.
      Overrides:
      toString in class java.util.EventObject
      Returns:
      A a String representation of this EventObject.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
This document was created by Dulcet from the OpenJDK sources. Copyright © 1993, 2012 Oracle and/or its affiliates. All rights reserved.

SourceForge