java::awt::event::ContainerEvent Class Reference

Inheritance diagram for java::awt::event::ContainerEvent:

Inheritance graph
java::awt::event::ComponentEventjava::awt::AWTEventjava::util::EventObjectjava::lang::Object
[legend]
Collaboration diagram for java::awt::event::ContainerEvent:

Collaboration graph
java::awt::event::ComponentEventjava::awt::AWTEventjava::util::EventObjectjava::lang::Objectjava::lang::ObjectRefjava::lang::Interfacejava::lang::Comparable
[legend]

List of all members.


Detailed Description

A low-level event which indicates that a container's contents changed because a component was added or removed.

Container events are provided for notification purposes ONLY; The AWT will automatically handle changes to the containers contents internally so that the program works properly regardless of whether the program is receiving these events or not.

This low-level event is generated by a container object (such as a Panel) when a component is added to it or removed from it. The event is passed to every ContainerListener or ContainerAdapter object which registered to receive such events using the component's addContainerListener method. (ContainerAdapter objects implement the ContainerListener interface.) Each such listener object gets this ContainerEvent when the event occurs.

See also:
ContainerAdapter

ContainerListener

Tutorial: Writing a Container Listener

Reference: The Java Class Libraries (update file)

Author:
Tim Prinzing

Amy Fowler

Version:
1.15 01/23/03
Since:
1.1

Public Types

enum  CONTAINER_EVENT_ID { CONTAINER_FIRST = 300, COMPONENT_ADDED = CONTAINER_FIRST, COMPONENT_REMOVED, CONTAINER_LAST = COMPONENT_REMOVED }

Public Member Functions

 ContainerEvent (const Ref< Component > &source=0, jint id=COMPONENT_FIRST, const Ref< Component > &child=0)
 Constructs a ContainerEvent object.
virtual Ref< ContainergetContainer () const
 Returns the originator of the event.
virtual Ref< ComponentgetChild () const
 Returns the component that was affected by the event.
virtual String paramString () const
 Returns a parameter string identifying this event.

Protected Attributes

Ref< Componentchild
 The non-null component that is being added or removed from the Container.

Member Enumeration Documentation

enum java::awt::event::ContainerEvent::CONTAINER_EVENT_ID

Enumerator:
CONTAINER_FIRST  The first number in the range of ids used for container events.
COMPONENT_ADDED  This event indicates that a component was added to the container.
COMPONENT_REMOVED  This event indicates that a component was removed from the container.
CONTAINER_LAST  The last number in the range of ids used for container events.


Constructor & Destructor Documentation

java::awt::event::ContainerEvent::ContainerEvent ( const Ref< Component > &  source = 0,
jint  id = COMPONENT_FIRST,
const Ref< Component > &  child = 0 
)

Constructs a ContainerEvent object.

Note that passing in an invalid id results in unspecified behavior.

Parameters:
source the Component object (container) that originated the event
id an integer indicating the type of event
child the component that was added or removed


Member Function Documentation

virtual Ref<Container> java::awt::event::ContainerEvent::getContainer (  )  const [virtual]

Returns the originator of the event.

Returns:
the Container object that originated the event

virtual Ref<Component> java::awt::event::ContainerEvent::getChild (  )  const [virtual]

Returns the component that was affected by the event.

Returns:
the Component object that was added or removed

virtual String java::awt::event::ContainerEvent::paramString (  )  const [virtual]

Returns a parameter string identifying this event.

This method is useful for event-logging and for debugging.

Returns:
a string identifying the event and its attributes

Reimplemented from java::awt::event::ComponentEvent.


Member Data Documentation

Ref<Component> java::awt::event::ContainerEvent::child [protected]

The non-null component that is being added or removed from the Container.

See also:
getChild()


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:15 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3