java.awt.event

Class ComponentEvent

public class ComponentEvent extends AWTEvent

This class is for events generated when a component is moved, resized, hidden, or shown. These events normally do not need to be handled by the application, since the AWT system automatically takes care of them. This is also the superclass for other events on components, but ComponentListeners ignore such subclasses.

Since: 1.1

See Also: ComponentAdapter ComponentListener

UNKNOWN: updated to 1.4

Field Summary
static intCOMPONENT_FIRST
This is the first id in the range of ids used by this class.
static intCOMPONENT_HIDDEN
This id indicates that a component was hidden.
static intCOMPONENT_LAST
This is the last id in the range of ids used by this class.
static intCOMPONENT_MOVED
This id indicates that a component was moved.
static intCOMPONENT_RESIZED
This id indicates that a component was resized.
static intCOMPONENT_SHOWN
This id indicates that a component was shown.
Constructor Summary
ComponentEvent(Component source, int id)
Initializes a new instance of ComponentEvent with the specified source and id.
Method Summary
ComponentgetComponent()
This method returns the event source as a Component.
StringparamString()
This method returns a string identifying this event.

Field Detail

COMPONENT_FIRST

public static final int COMPONENT_FIRST
This is the first id in the range of ids used by this class.

COMPONENT_HIDDEN

public static final int COMPONENT_HIDDEN
This id indicates that a component was hidden.

COMPONENT_LAST

public static final int COMPONENT_LAST
This is the last id in the range of ids used by this class.

COMPONENT_MOVED

public static final int COMPONENT_MOVED
This id indicates that a component was moved.

COMPONENT_RESIZED

public static final int COMPONENT_RESIZED
This id indicates that a component was resized.

COMPONENT_SHOWN

public static final int COMPONENT_SHOWN
This id indicates that a component was shown.

Constructor Detail

ComponentEvent

public ComponentEvent(Component source, int id)
Initializes a new instance of ComponentEvent with the specified source and id. Note that an invalid id leads to unspecified results.

Parameters: source the source of the event id the event id

Throws: IllegalArgumentException if source is null

Method Detail

getComponent

public Component getComponent()
This method returns the event source as a Component. If the source has subsequently been modified to a non-Component, this returns null.

Returns: the event source as a Component, or null

paramString

public String paramString()
This method returns a string identifying this event. This is the field name of the id type, and for COMPONENT_MOVED or COMPONENT_RESIZED, the new bounding box of the component.

Returns: a string identifying this event