< prev index next >
src/java.desktop/share/classes/java/awt/event/ActionEvent.java
Print this page
*** 30,50 ****
import java.lang.annotation.Native;
/**
* A semantic event which indicates that a component-defined action occurred.
* This high-level event is generated by a component (such as a
! * <code>Button</code>) when
* the component-specific action occurs (such as being pressed).
! * The event is passed to every <code>ActionListener</code> object
* that registered to receive such events using the component's
! * <code>addActionListener</code> method.
* <p>
! * <b>Note:</b> To invoke an <code>ActionEvent</code> on a
! * <code>Button</code> using the keyboard, use the Space bar.
* <P>
! * The object that implements the <code>ActionListener</code> interface
! * gets this <code>ActionEvent</code> when the event occurs. The listener
* is therefore spared the details of processing individual mouse movements
* and mouse clicks, and can instead process a "meaningful" (semantic)
* event like "button pressed".
* <p>
* An unspecified behavior will be caused if the {@code id} parameter
--- 30,50 ----
import java.lang.annotation.Native;
/**
* A semantic event which indicates that a component-defined action occurred.
* This high-level event is generated by a component (such as a
! * {@code Button}) when
* the component-specific action occurs (such as being pressed).
! * The event is passed to every {@code ActionListener} object
* that registered to receive such events using the component's
! * {@code addActionListener} method.
* <p>
! * <b>Note:</b> To invoke an {@code ActionEvent} on a
! * {@code Button} using the keyboard, use the Space bar.
* <P>
! * The object that implements the {@code ActionListener} interface
! * gets this {@code ActionEvent} when the event occurs. The listener
* is therefore spared the details of processing individual mouse movements
* and mouse clicks, and can instead process a "meaningful" (semantic)
* event like "button pressed".
* <p>
* An unspecified behavior will be caused if the {@code id} parameter
*** 135,174 ****
* JDK 1.1 serialVersionUID
*/
private static final long serialVersionUID = -7671078796273832149L;
/**
! * Constructs an <code>ActionEvent</code> object.
* <p>
* This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.
! * A <code>null</code> <code>command</code> string is legal,
* but not recommended.
*
* @param source The object that originated the event
* @param id An integer that identifies the event.
* For information on allowable values, see
* the class description for {@link ActionEvent}
* @param command A string that may specify a command (possibly one
* of several) associated with the event
! * @throws IllegalArgumentException if <code>source</code> is null
* @see #getSource()
* @see #getID()
* @see #getActionCommand()
*/
public ActionEvent(Object source, int id, String command) {
this(source, id, command, 0);
}
/**
! * Constructs an <code>ActionEvent</code> object with modifier keys.
* <p>
* This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.
! * A <code>null</code> <code>command</code> string is legal,
* but not recommended.
*
* @param source The object that originated the event
* @param id An integer that identifies the event.
* For information on allowable values, see
--- 135,174 ----
* JDK 1.1 serialVersionUID
*/
private static final long serialVersionUID = -7671078796273832149L;
/**
! * Constructs an {@code ActionEvent} object.
* <p>
* This method throws an
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.
! * A {@code null command} string is legal,
* but not recommended.
*
* @param source The object that originated the event
* @param id An integer that identifies the event.
* For information on allowable values, see
* the class description for {@link ActionEvent}
* @param command A string that may specify a command (possibly one
* of several) associated with the event
! * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getActionCommand()
*/
public ActionEvent(Object source, int id, String command) {
this(source, id, command, 0);
}
/**
! * Constructs an {@code ActionEvent} object with modifier keys.
* <p>
* This method throws an
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.
! * A {@code null command} string is legal,
* but not recommended.
*
* @param source The object that originated the event
* @param id An integer that identifies the event.
* For information on allowable values, see
*** 177,204 ****
* of several) associated with the event
* @param modifiers The modifier keys down during event
* (shift, ctrl, alt, meta).
* Passing negative parameter is not recommended.
* Zero value means that no modifiers were passed
! * @throws IllegalArgumentException if <code>source</code> is null
* @see #getSource()
* @see #getID()
* @see #getActionCommand()
* @see #getModifiers()
*/
public ActionEvent(Object source, int id, String command, int modifiers) {
this(source, id, command, 0, modifiers);
}
/**
! * Constructs an <code>ActionEvent</code> object with the specified
* modifier keys and timestamp.
* <p>
* This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.
! * A <code>null</code> <code>command</code> string is legal,
* but not recommended.
*
* @param source The object that originated the event
* @param id An integer that identifies the event.
* For information on allowable values, see
--- 177,204 ----
* of several) associated with the event
* @param modifiers The modifier keys down during event
* (shift, ctrl, alt, meta).
* Passing negative parameter is not recommended.
* Zero value means that no modifiers were passed
! * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getActionCommand()
* @see #getModifiers()
*/
public ActionEvent(Object source, int id, String command, int modifiers) {
this(source, id, command, 0, modifiers);
}
/**
! * Constructs an {@code ActionEvent} object with the specified
* modifier keys and timestamp.
* <p>
* This method throws an
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.
! * A {@code null command} string is legal,
* but not recommended.
*
* @param source The object that originated the event
* @param id An integer that identifies the event.
* For information on allowable values, see
*** 210,220 ****
* Passing negative parameter is not recommended.
* Zero value means that no modifiers were passed
* @param when A long that gives the time the event occurred.
* Passing negative or zero value
* is not recommended
! * @throws IllegalArgumentException if <code>source</code> is null
* @see #getSource()
* @see #getID()
* @see #getActionCommand()
* @see #getModifiers()
* @see #getWhen()
--- 210,220 ----
* Passing negative parameter is not recommended.
* Zero value means that no modifiers were passed
* @param when A long that gives the time the event occurred.
* Passing negative or zero value
* is not recommended
! * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getActionCommand()
* @see #getModifiers()
* @see #getWhen()
*** 235,247 ****
* commands, depending on its state. For example, a single button might
* toggle between "show details" and "hide details". The source object
* and the event would be the same in each case, but the command string
* would identify the intended action.
* <p>
! * Note that if a <code>null</code> command string was passed
! * to the constructor for this <code>ActionEvent</code>, this
! * this method returns <code>null</code>.
*
* @return the string identifying the command for this event
*/
public String getActionCommand() {
return actionCommand;
--- 235,247 ----
* commands, depending on its state. For example, a single button might
* toggle between "show details" and "hide details". The source object
* and the event would be the same in each case, but the command string
* would identify the intended action.
* <p>
! * Note that if a {@code null} command string was passed
! * to the constructor for this {@code ActionEvent}, this
! * this method returns {@code null}.
*
* @return the string identifying the command for this event
*/
public String getActionCommand() {
return actionCommand;
< prev index next >