home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Java AWT

Previous Chapter 19
java.awt Reference
Next
 

AWTEvent (New)

Name

AWTEvent (New)

[Graphic: Figure from the text]

Description

The root class of all AWT events. Subclasses of this class are the replacement for java.awt.Event, which is only used for the Java 1.0.2 event model. In Java 1.1, event objects are passed from event source components to objects implementing a corresponding listener interface. Some event sources have a corresponding interface, too. For example, AdjustmentEvents are passed from Adjustable objects to AdjustmentListeners. Some event types do not have corresponding interfaces; for example, ActionEvents are passed from Buttons to ActionListeners, but there is no "Actionable" interface that Button implements.

Class Definition

public abstract class java.awt.AWTEvent
    extends java.util.EventObject {
  // Constants
  public final static long ACTION_EVENT_MASK;
  public final static long ADJUSTMENT_EVENT_MASK;
  public final static long COMPONENT_EVENT_MASK;
  public final static long CONTAINER_EVENT_MASK;
  public final static long FOCUS_EVENT_MASK;
  public final static long ITEM_EVENT_MASK;
  public final static long KEY_EVENT_MASK;
  public final static long MOUSE_EVENT_MASK;
  public final static long MOUSE_MOTION_EVENT_MASK;
  public final static long RESERVED_ID_MAX;
  public final static long TEXT_EVENT_MASK;
  public final static long WINDOW_EVENT_MASK;
  // Variables
  protected boolean consumed;
  protected int id;
  // Constructors
  public AWTEvent (Event event);
  public AWTEvent (Object source, int id);
  // Instance Methods
  public int getID();
  public String paramString();
  public String toString();
  // Protected Instance Methods
  protected void consume();
  protected boolean isConsumed();
}

Variables

consumed

protected boolean consumed

If consumed is true, the event will not be sent back to the peer. Semantic events will never be sent back to a peer; thus consumed is always true for semantic events.

id

protected int id

The type ID of this event.

Constructors

AWTEvent

public AWTEvent (Event event)

Parameters

event

A version 1.0.2 java.awt.Event object.

Description

Constructs a 1.1 java.awt.AWTEvent derived from a 1.0.2 java.awt.Event object.

public AWTEvent (Object source, int id)

Parameters

source

The object that the event originated from.

id

An event type ID.

Description

Constructs an AWTEvent object.

Instance Methods

getID

public int getID()

Returns

The type ID of the event.

paramString

public String paramString()

Returns

A string with the current settings of AWTEvent.

Description

Helper method for toString() that generates a string of current settings.

toString

public String toString()

Returns

A string representation of the AWTEvent object.

Overrides

Object.toString()

Protected Instance Methods

consume

protected void consume()

Description

Consumes the event so it is not sent back to its source.

isConsumed

public boolean isConsumed()

Returns

A flag indicating whether this event has been consumed.

See Also

ActionEvent, AdjustmentEvent, ComponentEvent, Event, EventObject, FocusEvent, ItemEvent, KeyEvent, MouseEvent, WindowEvent


Previous Home Next
AWTError Book Index AWTEventMulticaster (New)

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java