All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.awt.event.ActionEvent Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
/*

NOTICE


(c) 2005-2007 Sun Microsystems, Inc. All Rights Reserved.

Neither this file nor any files generated from it describe a complete specification, and they may only be used as described below. For example, no permission is given for you to incorporate this file, in whole or in part, in an implementation of a Java specification.

Sun Microsystems Inc. owns the copyright in this file and it is provided to you for informative, as opposed to normative, use. The file and any files generated from it may be used to generate other informative documentation, such as a unified set of documents of API signatures for a platform that includes technologies expressed as Java APIs. The file may also be used to produce "compilation stubs," which allow applications to be compiled and validated for such platforms.

Any work generated from this file, such as unified javadocs or compiled stub files, must be accompanied by this notice in its entirety.

This work corresponds to the API signatures of JSR 217: Personal Basis Profile 1.1. In the event of a discrepency between this work and the JSR 217 specification, which is available at http://www.jcp.org/en/jsr/detail?id=217, the latter takes precedence. */ package java.awt.event; import java.awt.AWTEvent; // import java.awt.Event; /** * A semantic event which indicates that a component-defined action occured. * This high-level event is generated by a component (such as a Button) when * the component-specific action occurs (such as being pressed). * The event is passed to every every ActionListener object * that registered to receive such events using the component's * addActionListener method. *

* The object that implements the ActionListener interface * gets this 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". * *

* Note: The timestamps used by this class report the difference, * measured in milliseconds, between the time of the event and midnight, * January 1, 1970 UTC * (similar to {@link java.lang.System.currentTimeMillis}). * * @see ActionListener * @see Tutorial: Java 1.1 Event Model * @see Reference: The Java Class Libraries (update file) * * @author Carl Quinn * @version 1.25 01/23/03 * @since 1.1 */ public class ActionEvent extends AWTEvent { /** * The shift modifier. An indicator that the shift key was held * down during the event. */ public static final int SHIFT_MASK = 1 << 0; /** * The control modifier. An indicator that the control key was held * down during the event. */ public static final int CTRL_MASK = 1 << 1; /** * The meta modifier. An indicator that the meta key was held * down during the event. */ public static final int META_MASK = 1 << 2; /** * The alt modifier. An indicator that the alt key was held * down during the event. */ public static final int ALT_MASK = 1 << 3; /** * The first number in the range of ids used for action events. */ public static final int ACTION_FIRST = 1001; /** * The last number in the range of ids used for action events. */ public static final int ACTION_LAST = 1001; /** * This event id indicates that a meaningful action occured. */ public static final int ACTION_PERFORMED = ACTION_FIRST; /** * The nonlocalized string that gives more details * of what actually caused the event. * This information is very specific to the component * that fired it. * * @serial * @see #getActionCommand */ String actionCommand; /** * Timestamp of when this event occurred. Because an ActionEvent is a high- * level, semantic event, the timestamp is typically the same as an * underlying InputEvent. * * @serial * @see #getWhen */ long when; /** * This represents the key modifier that was selected, * and is used to determine the state of the selected key. * If no modifier has been selected it will default to * zero. * * @serial * @see #getModifiers */ int modifiers; /* * JDK 1.1 serialVersionUID */ private static final long serialVersionUID = -7671078796273832149L; /** * Constructs an ActionEvent object. *

Note that passing in an invalid id results in * unspecified behavior. * * @param source the object that originated the event * @param id an integer that identifies the event * @param command a string that may specify a command (possibly one * of several) associated with the event */ public ActionEvent(Object source, int id, String command) {super(null, 0); } /** * Constructs an ActionEvent object with modifier keys. *

Note that passing in an invalid id results in * unspecified behavior. * * @param source the object that originated the event * @param id an integer that identifies the event * @param command a string that may specify a command (possibly one * of several) associated with the event * @param modifiers the modifier keys held down during this action */ public ActionEvent(Object source, int id, String command, int modifiers) { super(null, 0); } /** * Constructs an ActionEvent object with the specified * modifier keys and timestamp. *

* Note that passing in an invalid id results in unspecified * behavior. * * @param source the object that originated the event * @param id an integer that identifies the event * @param command a string that may specify a command (possibly one * of several) associated with the event * @param when the time the event occurred * @param modifiers the modifier keys held down during this action * * @since 1.4 */ public ActionEvent(Object source, int id, String command, long when, int modifiers) { super(null, 0); } /** * Returns the command string associated with this action. * This string allows a "modal" component to specify one of several * 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. * * @return the string identifying the command for this event */ public String getActionCommand() {return null; } /** * Returns the timestamp of when this event occurred. Because an * ActionEvent is a high-level, semantic event, the timestamp is typically * the same as an underlying InputEvent. * * @return this event's timestamp * @since 1.4 */ public long getWhen() { return 0; } /** * Returns the modifier keys held down during this action event. * * @return the bitwise-or of the modifier constants */ public int getModifiers() { return 0;} /** * Returns a parameter string identifying this action event. * This method is useful for event-logging and for debugging. * * @return a string identifying the event and its associated command */ public String paramString() {return null; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy