< prev index next >
src/java.desktop/share/classes/java/awt/event/InvocationEvent.java
Print this page
@@ -29,20 +29,20 @@
import java.awt.ActiveEvent;
import java.awt.AWTEvent;
/**
- * An event which executes the <code>run()</code> method on a <code>Runnable
- * </code> when dispatched by the AWT event dispatcher thread. This class can
- * be used as a reference implementation of <code>ActiveEvent</code> rather
- * than declaring a new class and defining <code>dispatch()</code>.<p>
- *
- * Instances of this class are placed on the <code>EventQueue</code> by calls
- * to <code>invokeLater</code> and <code>invokeAndWait</code>. Client code
- * can use this fact to write replacement functions for <code>invokeLater
- * </code> and <code>invokeAndWait</code> without writing special-case code
- * in any <code>AWTEventListener</code> objects.
+ * An event which executes the {@code run()} method on a {@code Runnable
+ * } when dispatched by the AWT event dispatcher thread. This class can
+ * be used as a reference implementation of {@code ActiveEvent} rather
+ * than declaring a new class and defining {@code dispatch()}.<p>
+ *
+ * Instances of this class are placed on the {@code EventQueue} by calls
+ * to {@code invokeLater} and {@code invokeAndWait}. Client code
+ * can use this fact to write replacement functions for {@code invokeLater
+ * } and {@code invokeAndWait} without writing special-case code
+ * in any {@code AWTEventListener} objects.
* <p>
* An unspecified behavior will be caused if the {@code id} parameter
* of any particular {@code InvocationEvent} instance is not
* in the range from {@code INVOCATION_FIRST} to {@code INVOCATION_LAST}.
*
@@ -104,11 +104,11 @@
* @since 1.8
*/
private final Runnable listener;
/**
- * Indicates whether the <code>run()</code> method of the <code>runnable</code>
+ * Indicates whether the {@code run()} method of the {@code runnable}
* was executed or not.
*
* @see #isDispatched
* @since 1.7
*/
@@ -147,132 +147,134 @@
* JDK 1.1 serialVersionUID.
*/
private static final long serialVersionUID = 436056344909459450L;
/**
- * Constructs an <code>InvocationEvent</code> with the specified
- * source which will execute the runnable's <code>run</code>
+ * Constructs an {@code InvocationEvent} with the specified
+ * source which will execute the runnable's {@code run}
* method when dispatched.
* <p>This is a convenience constructor. An invocation of the form
- * <tt>InvocationEvent(source, runnable)</tt>
+ * {@code InvocationEvent(source, runnable)}
* behaves in exactly the same way as the invocation of
- * <tt>{@link #InvocationEvent(Object, Runnable, Object, boolean) InvocationEvent}(source, runnable, null, false)</tt>.
- * <p> This method throws an <code>IllegalArgumentException</code>
- * if <code>source</code> is <code>null</code>.
+ * {@link #InvocationEvent(Object, Runnable, Object, boolean)
+ * InvocationEvent(source, runnable, null, false)}.
+ * <p> This method throws an {@code IllegalArgumentException}
+ * if {@code source} is {@code null}.
*
- * @param source The <code>Object</code> that originated the event
- * @param runnable The <code>Runnable</code> whose <code>run</code>
+ * @param source The {@code Object} that originated the event
+ * @param runnable The {@code Runnable} whose {@code run}
* method will be executed
- * @throws IllegalArgumentException if <code>source</code> is null
+ * @throws IllegalArgumentException if {@code source} is null
*
* @see #getSource()
* @see #InvocationEvent(Object, Runnable, Object, boolean)
*/
public InvocationEvent(Object source, Runnable runnable) {
this(source, INVOCATION_DEFAULT, runnable, null, null, false);
}
/**
- * Constructs an <code>InvocationEvent</code> with the specified
- * source which will execute the runnable's <code>run</code>
- * method when dispatched. If notifier is non-<code>null</code>,
- * <code>notifyAll()</code> will be called on it
- * immediately after <code>run</code> has returned or thrown an exception.
- * <p>An invocation of the form <tt>InvocationEvent(source,
- * runnable, notifier, catchThrowables)</tt>
+ * Constructs an {@code InvocationEvent} with the specified
+ * source which will execute the runnable's {@code run}
+ * method when dispatched. If notifier is non-{@code null},
+ * {@code notifyAll()} will be called on it
+ * immediately after {@code run} has returned or thrown an exception.
+ * <p>An invocation of the form
+ * {@code InvocationEvent(source, runnable, notifier, catchThrowables)}
* behaves in exactly the same way as the invocation of
- * <tt>{@link #InvocationEvent(Object, int, Runnable, Object, boolean) InvocationEvent}(source, InvocationEvent.INVOCATION_DEFAULT, runnable, notifier, catchThrowables)</tt>.
- * <p>This method throws an <code>IllegalArgumentException</code>
- * if <code>source</code> is <code>null</code>.
+ * {@link #InvocationEvent(Object, int, Runnable, Object, boolean)
+ * InvocationEvent(source, InvocationEvent.INVOCATION_DEFAULT, runnable, notifier, catchThrowables)}.
+ * <p>This method throws an {@code IllegalArgumentException}
+ * if {@code source} is {@code null}.
*
- * @param source The <code>Object</code> that originated
+ * @param source The {@code Object} that originated
* the event
- * @param runnable The <code>Runnable</code> whose
- * <code>run</code> method will be
+ * @param runnable The {@code Runnable} whose
+ * {@code run} method will be
* executed
- * @param notifier The {@code Object} whose <code>notifyAll</code>
+ * @param notifier The {@code Object} whose {@code notifyAll}
* method will be called after
- * <code>Runnable.run</code> has returned or
+ * {@code Runnable.run} has returned or
* thrown an exception or after the event was
* disposed
- * @param catchThrowables Specifies whether <code>dispatch</code>
+ * @param catchThrowables Specifies whether {@code dispatch}
* should catch Throwable when executing
- * the <code>Runnable</code>'s <code>run</code>
+ * the {@code Runnable}'s {@code run}
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
- * @throws IllegalArgumentException if <code>source</code> is null
+ * @throws IllegalArgumentException if {@code source} is null
*
* @see #getSource()
* @see #InvocationEvent(Object, int, Runnable, Object, boolean)
*/
public InvocationEvent(Object source, Runnable runnable, Object notifier,
boolean catchThrowables) {
this(source, INVOCATION_DEFAULT, runnable, notifier, null, catchThrowables);
}
/**
- * Constructs an <code>InvocationEvent</code> with the specified
- * source which will execute the runnable's <code>run</code>
- * method when dispatched. If listener is non-<code>null</code>,
- * <code>listener.run()</code> will be called immediately after
- * <code>run</code> has returned, thrown an exception or the event
+ * Constructs an {@code InvocationEvent} with the specified
+ * source which will execute the runnable's {@code run}
+ * method when dispatched. If listener is non-{@code null},
+ * {@code listener.run()} will be called immediately after
+ * {@code run} has returned, thrown an exception or the event
* was disposed.
- * <p>This method throws an <code>IllegalArgumentException</code>
- * if <code>source</code> is <code>null</code>.
+ * <p>This method throws an {@code IllegalArgumentException}
+ * if {@code source} is {@code null}.
*
- * @param source The <code>Object</code> that originated
+ * @param source The {@code Object} that originated
* the event
- * @param runnable The <code>Runnable</code> whose
- * <code>run</code> method will be
+ * @param runnable The {@code Runnable} whose
+ * {@code run} method will be
* executed
- * @param listener The <code>Runnable</code>Runnable whose
- * <code>run()</code> method will be called
+ * @param listener The {@code Runnable}Runnable whose
+ * {@code run()} method will be called
* after the {@code InvocationEvent}
* was dispatched or disposed
- * @param catchThrowables Specifies whether <code>dispatch</code>
+ * @param catchThrowables Specifies whether {@code dispatch}
* should catch Throwable when executing
- * the <code>Runnable</code>'s <code>run</code>
+ * the {@code Runnable}'s {@code run}
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
- * @throws IllegalArgumentException if <code>source</code> is null
+ * @throws IllegalArgumentException if {@code source} is null
*/
public InvocationEvent(Object source, Runnable runnable, Runnable listener,
boolean catchThrowables) {
this(source, INVOCATION_DEFAULT, runnable, null, listener, catchThrowables);
}
/**
- * Constructs an <code>InvocationEvent</code> with the specified
- * source and ID which will execute the runnable's <code>run</code>
- * method when dispatched. If notifier is non-<code>null</code>,
- * <code>notifyAll</code> will be called on it immediately after
- * <code>run</code> has returned or thrown an exception.
+ * Constructs an {@code InvocationEvent} with the specified
+ * source and ID which will execute the runnable's {@code run}
+ * method when dispatched. If notifier is non-{@code null},
+ * {@code notifyAll} will be called on it immediately after
+ * {@code run} has returned or thrown an exception.
* <p>This method throws an
- * <code>IllegalArgumentException</code> if <code>source</code>
- * is <code>null</code>.
+ * {@code IllegalArgumentException} if {@code source}
+ * is {@code null}.
*
- * @param source The <code>Object</code> that originated
+ * @param source The {@code Object} that originated
* the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link InvocationEvent}
- * @param runnable The <code>Runnable</code> whose
- * <code>run</code> method will be executed
- * @param notifier The <code>Object</code> whose <code>notifyAll</code>
+ * @param runnable The {@code Runnable} whose
+ * {@code run} method will be executed
+ * @param notifier The {@code Object} whose {@code notifyAll}
* method will be called after
- * <code>Runnable.run</code> has returned or
+ * {@code Runnable.run} has returned or
* thrown an exception or after the event was
* disposed
- * @param catchThrowables Specifies whether <code>dispatch</code>
+ * @param catchThrowables Specifies whether {@code dispatch}
* should catch Throwable when executing the
- * <code>Runnable</code>'s <code>run</code>
+ * {@code Runnable}'s {@code run}
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
- * @throws IllegalArgumentException if <code>source</code> is null
+ * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
*/
protected InvocationEvent(Object source, int id, Runnable runnable,
Object notifier, boolean catchThrowables) {
@@ -287,12 +289,12 @@
this.listener = listener;
this.catchExceptions = catchThrowables;
this.when = System.currentTimeMillis();
}
/**
- * Executes the Runnable's <code>run()</code> method and notifies the
- * notifier (if any) when <code>run()</code> has returned or thrown an exception.
+ * Executes the Runnable's {@code run()} method and notifies the
+ * notifier (if any) when {@code run()} has returned or thrown an exception.
*
* @see #isDispatched
*/
public void dispatch() {
try {
@@ -314,24 +316,24 @@
finishedDispatching(true);
}
}
/**
- * Returns any Exception caught while executing the Runnable's <code>run()
- * </code> method.
+ * Returns any Exception caught while executing
+ * the Runnable's {@code run()} method.
*
* @return A reference to the Exception if one was thrown; null if no
* Exception was thrown or if this InvocationEvent does not
* catch exceptions
*/
public Exception getException() {
return (catchExceptions) ? exception : null;
}
/**
- * Returns any Throwable caught while executing the Runnable's <code>run()
- * </code> method.
+ * Returns any Throwable caught while executing
+ * the Runnable's {@code run()} method.
*
* @return 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
< prev index next >