java.awt

Class Component

Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Known Direct Subclasses:
Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, TextComponent

public abstract class Component
extends Object
implements ImageObserver, MenuContainer, Serializable

The root of all evil. All graphical representations are subclasses of this giant class, which is designed for screen display and user interaction. This class can be extended directly to build a lightweight component (one not associated with a native window); lightweight components must reside inside a heavyweight window.

This class is Serializable, which has some big implications. A user can save the state of all graphical components in one VM, and reload them in another. Note that this class will only save Serializable listeners, and ignore the rest, without causing any serialization exceptions. However, by making a listener serializable, and adding it to another element, you link in that entire element to the state of this component. To get around this, use the idiom shown in the example below - make listeners non-serializable in inner classes, rather than using this object itself as the listener, if external objects do not need to save the state of this object.

 import java.awt.*;
 import java.awt.event.*;
 import java.io.Serializable;
 class MyApp implements Serializable
 {
   BigObjectThatShouldNotBeSerializedWithAButton bigOne;
   // Serializing aButton will not suck in an instance of MyApp, with its
   // accompanying field bigOne.
   Button aButton = new Button();
   class MyActionListener implements ActionListener
   {
     public void actionPerformed(ActionEvent e)
     {
       System.out.println("Hello There");
     }
   }
   MyApp()
   {
     aButton.addActionListener(new MyActionListener());
   }
 }
 

Status: Incomplete. The event dispatch mechanism is implemented. All other methods defined in the J2SE 1.3 API javadoc exist, but are mostly incomplete or only stubs; except for methods relating to the Drag and Drop, Input Method, and Accessibility frameworks: These methods are present but commented out.

Since:
1.0
See Also:
Serialized Form

Nested Class Summary

protected abstract class
Component.AccessibleAWTComponent
This class provides accessibility support for subclasses of container.
protected class
Component.BltBufferStrategy
This class provides support for blitting offscreen surfaces to a component.
protected class
Component.FlipBufferStrategy
This class provides support for flipping component buffers.

Field Summary

static float
BOTTOM_ALIGNMENT
Constant returned by the getAlignmentY method to indicate that the component wishes to be aligned to the bottom relative to other components.
static float
CENTER_ALIGNMENT
Constant returned by the getAlignmentY and getAlignmentX methods to indicate that the component wishes to be aligned to the center relative to other components.
static float
LEFT_ALIGNMENT
Constant returned by the getAlignmentX method to indicate that the component wishes to be aligned to the left relative to other components.
static float
RIGHT_ALIGNMENT
Constant returned by the getAlignmentX method to indicate that the component wishes to be aligned to the right relative to other components.
static float
TOP_ALIGNMENT
Constant returned by the getAlignmentY method to indicate that the component wishes to be aligned to the top relative to other components.

Fields inherited from interface java.awt.image.ImageObserver

ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH

Constructor Summary

Component()
Default constructor for subclasses.

Method Summary

boolean
action(Event evt, Object what)
Deprecated. in classes which support actions, use processActionEvent(ActionEvent) instead
void
add(PopupMenu popup)
Adds the specified popup menu to this component.
void
addComponentListener(ComponentListener listener)
Adds the specified listener to this component.
void
addFocusListener(FocusListener listener)
Adds the specified listener to this component.
void
addHierarchyBoundsListener(HierarchyBoundsListener listener)
Adds the specified listener to this component.
void
addHierarchyListener(HierarchyListener listener)
Adds the specified listener to this component.
void
addInputMethodListener(InputMethodListener listener)
Adds the specified listener to this component.
void
addKeyListener(KeyListener listener)
Adds the specified listener to this component.
void
addMouseListener(MouseListener listener)
Adds the specified listener to this component.
void
addMouseMotionListener(MouseMotionListener listener)
Adds the specified listener to this component.
void
addMouseWheelListener(MouseWheelListener listener)
Adds the specified listener to this component.
void
addNotify()
Called when the parent of this Component is made visible or when the Component is added to an already visible Container and needs to be shown.
void
addPropertyChangeListener(PropertyChangeListener listener)
Adds the specified property listener to this component.
void
addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Adds the specified property listener to this component.
void
applyComponentOrientation(ComponentOrientation o)
Sets the text layout orientation of this component.
boolean
areFocusTraversalKeysSet(int id)
Tests whether the focus traversal keys for a given action are explicitly set or inherited.
Rectangle
bounds()
Deprecated. use getBounds() instead
int
checkImage(Image image, int width, int height, ImageObserver observer)
Returns the status of the loading of the specified image.
int
checkImage(Image image, ImageObserver observer)
Returns the status of the loading of the specified image.
protected AWTEvent
coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent)
This is called by the EventQueue if two events with the same event id and owner component are queued.
boolean
contains(int x, int y)
Tests whether or not the specified point is contained within this component.
boolean
contains(Point p)
Tests whether or not the specified point is contained within this component.
Image
createImage(int width, int height)
Creates an image with the specified width and height for use in double buffering.
Image
createImage(ImageProducer producer)
Creates an image from the specified producer.
VolatileImage
createVolatileImage(int width, int height)
Creates an image with the specified width and height for use in double buffering.
VolatileImage
createVolatileImage(int width, int height, ImageCapabilities caps)
Creates an image with the specified width and height for use in double buffering.
void
deliverEvent(Event e)
Deprecated. use (AWTEvent) instead
void
disable()
Deprecated. use setEnabled(boolean) instead
protected void
disableEvents(long eventsToDisable)
Disables the specified events.
void
dispatchEvent(AWTEvent e)
Forwards AWT events to processEvent() if:
  • Events have been enabled for this type of event via enableEvents()
  • There is at least one registered listener for this type of event
void
doLayout()
Calls the layout manager to re-layout the component.
void
enable()
Deprecated. use setEnabled(boolean) instead
void
enable(boolean enabled)
Deprecated. use setEnabled(boolean) instead
protected void
enableEvents(long eventsToEnable)
Enables the specified events.
void
enableInputMethods(boolean enable)
Enables or disables input method support for this component.
extends EventListener> T[] getListeners(Class listenerType)
Returns all registered EventListeners of the given listenerType.
protected void
firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
Report a change in a bound property to any registered property listeners.
void
firePropertyChange(String propertyName, byte oldValue, byte newValue)
Report a change in a bound property to any registered property listeners.
void
firePropertyChange(String propertyName, char oldValue, char newValue)
Report a change in a bound property to any registered property listeners.
void
firePropertyChange(String propertyName, double oldValue, double newValue)
Report a change in a bound property to any registered property listeners.
void
firePropertyChange(String propertyName, float oldValue, float newValue)
Report a change in a bound property to any registered property listeners.
protected void
firePropertyChange(String propertyName, int oldValue, int newValue)
Report a change in a bound property to any registered property listeners.
protected void
firePropertyChange(String propertyName, Object oldValue, Object newValue)
Report a change in a bound property to any registered property listeners.
void
firePropertyChange(String propertyName, long oldValue, long newValue)
Report a change in a bound property to any registered property listeners.
void
firePropertyChange(String propertyName, short oldValue, short newValue)
Report a change in a bound property to any registered property listeners.
AccessibleContext
getAccessibleContext()
Returns the accessibility framework context of this class.
float
getAlignmentX()
Returns the preferred horizontal alignment of this component.
float
getAlignmentY()
Returns the preferred vertical alignment of this component.
Color
getBackground()
Returns this component's background color.
Rectangle
getBounds()
Returns a bounding rectangle for this component.
Rectangle
getBounds(Rectangle r)
Returns the bounds of this component.
ColorModel
getColorModel()
Returns the color model of the device this componet is displayed on.
Component
getComponentAt(int x, int y)
Returns the component occupying the position (x,y).
Component
getComponentAt(Point p)
Returns the component occupying the position (x,y).
ComponentListener[]
getComponentListeners()
Returns an array of all specified listeners registered on this component.
ComponentOrientation
getComponentOrientation()
Determines the text layout orientation used by this component.
Cursor
getCursor()
Returns the cursor for this component.
DropTarget
getDropTarget()
Gets the associated drag-and-drop target, if there is one.
Container
getFocusCycleRootAncestor()
Returns the root container that owns the focus cycle where this component resides.
FocusListener[]
getFocusListeners()
Returns an array of all specified listeners registered on this component.
Set
getFocusTraversalKeys(int id)
Returns the set of keys for a given focus traversal action, as defined in setFocusTraversalKeys.
boolean
getFocusTraversalKeysEnabled()
Check whether or not focus traversal keys are enabled on this Component.
Font
getFont()
Returns the font in use for this component.
FontMetrics
getFontMetrics(Font font)
Returns the font metrics for the specified font in this component.
Color
getForeground()
Returns this component's foreground color.
Graphics
getGraphics()
Returns a graphics object for this component.
GraphicsConfiguration
getGraphicsConfiguration()
Returns the graphics configuration of this component, if there is one.
int
getHeight()
Gets the height of the component.
HierarchyBoundsListener[]
getHierarchyBoundsListeners()
Returns an array of all specified listeners registered on this component.
HierarchyListener[]
getHierarchyListeners()
Returns an array of all specified listeners registered on this component.
boolean
getIgnoreRepaint()
Test whether paint events from the operating system are ignored.
InputContext
getInputContext()
Gets the input context of this component, which is inherited from the parent unless this is overridden.
InputMethodListener[]
getInputMethodListeners()
Returns an array of all specified listeners registered on this component.
InputMethodRequests
getInputMethodRequests()
Returns the input method request handler, for subclasses which support on-the-spot text input.
KeyListener[]
getKeyListeners()
Returns an array of all specified listeners registered on this component.
Locale
getLocale()
Returns the locale for this component.
Point
getLocation()
Returns the location of this component's top left corner relative to its parent component.
Point
getLocation(Point p)
Returns the location of this component.
Point
getLocationOnScreen()
Returns the location of this component's top left corner in screen coordinates.
Dimension
getMaximumSize()
Returns the component's maximum size.
Dimension
getMinimumSize()
Returns the component's minimum size.
MouseListener[]
getMouseListeners()
Returns an array of all specified listeners registered on this component.
MouseMotionListener[]
getMouseMotionListeners()
Returns an array of all specified listeners registered on this component.
MouseWheelListener[]
getMouseWheelListeners()
Returns an array of all specified listeners registered on this component.
String
getName()
Returns the name of this component.
Container
getParent()
Returns the parent of this component.
ComponentPeer
getPeer()
Deprecated. user programs should not directly manipulate peers; use isDisplayable() instead
Dimension
getPreferredSize()
Returns the component's preferred size.
PropertyChangeListener[]
getPropertyChangeListeners()
Returns an array of all specified listeners registered on this component.
PropertyChangeListener[]
getPropertyChangeListeners(String property)
Returns an array of all specified listeners on the named property that are registered on this component.
Dimension
getSize()
Returns the size of this object.
Dimension
getSize(Dimension d)
Returns the size of this component.
Toolkit
getToolkit()
Returns the toolkit in use for this component.
Object
getTreeLock()
Returns the object used for synchronization locks on this component when performing tree and layout functions.
int
getWidth()
Gets the width of the component.
int
getX()
Gets the x coordinate of the upper left corner.
int
getY()
Gets the y coordinate of the upper left corner.
boolean
gotFocus(Event evt, Object what)
Deprecated. use processFocusEvent(FocusEvent) instead
boolean
handleEvent(Event evt)
Deprecated. use processEvent(AWTEvent) instead
boolean
hasFocus()
Tests if this component is the focus owner.
void
hide()
Deprecated. use setVisible(boolean) instead
boolean
imageUpdate(Image img, int flags, int x, int y, int w, int h)
Called when an image has changed so that this component is repainted.
boolean
inside(int x, int y)
Deprecated. use contains(int,int) instead
void
invalidate()
Invalidates this component and all of its parent components.
boolean
isBackgroundSet()
Tests if the background was explicitly set, or just inherited from the parent.
boolean
isCursorSet()
Tests if the cursor was explicitly set, or just inherited from the parent.
boolean
isDisplayable()
Tests if the component is displayable.
boolean
isDoubleBuffered()
Checks if this image is painted to an offscreen image buffer that is later copied to screen (double buffering reduces flicker).
boolean
isEnabled()
Tests whether or not this component is enabled.
boolean
isFocusCycleRoot(Container c)
Tests if the container is the ancestor of the focus cycle that this component belongs to.
boolean
isFocusOwner()
Tests if this component is the focus owner.
boolean
isFocusTraversable()
Deprecated. use isFocusable() instead
boolean
isFocusable()
Tests if this component can receive focus.
boolean
isFontSet()
Tests if the font was explicitly set, or just inherited from the parent.
boolean
isForegroundSet()
Tests if the foreground was explicitly set, or just inherited from the parent.
boolean
isLightweight()
Return whether the component is lightweight.
boolean
isMaximumSizeSet()
Returns true if the current maximum size is not null and was set by a call to setMaximumSize(Dimension), otherwise returns false.
boolean
isMinimumSizeSet()
Returns true if the current minimum size is not null and was set by a call to setMinimumSize(Dimension), otherwise returns false.
boolean
isOpaque()
Tests if this component is opaque.
boolean
isPreferredSizeSet()
Returns true if the current preferred size is not null and was set by a call to setPreferredSize(Dimension), otherwise returns false.
boolean
isShowing()
Tests whether or not this component is actually being shown on the screen.
boolean
isValid()
Tests whether or not this component is valid.
boolean
isVisible()
Tests whether or not this component is visible.
boolean
keyDown(Event evt, int key)
Deprecated. use processKeyEvent(KeyEvent) instead
boolean
keyUp(Event evt, int key)
Deprecated. use processKeyEvent(KeyEvent) instead
void
layout()
Deprecated. use doLayout() instead
void
list()
Prints a listing of this component to System.out.
void
list(PrintStream out)
Prints a listing of this component to the specified print stream.
void
list(PrintStream out, int indent)
Prints a listing of this component to the specified print stream, starting at the specified indentation point.
void
list(PrintWriter out)
Prints a listing of this component to the specified print writer.
void
list(PrintWriter out, int indent)
Prints a listing of this component to the specified print writer, starting at the specified indentation point.
Component
locate(int x, int y)
Deprecated. use getComponentAt(int,int) instead
Point
location()
Deprecated. use getLocation() instead
boolean
lostFocus(Event evt, Object what)
Deprecated. use processFocusEvent(FocusEvent) instead
Dimension
minimumSize()
Deprecated. use getMinimumSize() instead
boolean
mouseDown(Event evt, int x, int y)
Deprecated. use processMouseEvent(MouseEvent) instead
boolean
mouseDrag(Event evt, int x, int y)
Deprecated. use processMouseMotionEvent(MouseEvent) instead
boolean
mouseEnter(Event evt, int x, int y)
Deprecated. use processMouseEvent(MouseEvent) instead
boolean
mouseExit(Event evt, int x, int y)
Deprecated. use processMouseEvent(MouseEvent) instead
boolean
mouseMove(Event evt, int x, int y)
Deprecated. use processMouseMotionEvent(MouseEvent) instead
boolean
mouseUp(Event evt, int x, int y)
Deprecated. use processMouseEvent(MouseEvent) instead
void
move(int x, int y)
Deprecated. use setLocation(int,int) instead
void
nextFocus()
Deprecated. use () instead
void
paint(Graphics g)
Paints this component on the screen.
void
paintAll(Graphics g)
Paints this entire component, including any sub-components.
protected String
paramString()
Returns a debugging string representing this component.
boolean
postEvent(Event e)
Deprecated. use dispatchEvent(AWTEvent) instead
Dimension
preferredSize()
Deprecated. use getPreferredSize() instead
boolean
prepareImage(Image image, int width, int height, ImageObserver observer)
Prepares the specified image for rendering on this component at the specified scaled width and height
boolean
prepareImage(Image image, ImageObserver observer)
Prepares the specified image for rendering on this component.
void
print(Graphics g)
Prints this component.
void
printAll(Graphics g)
Prints this component, including all sub-components.
protected void
processComponentEvent(ComponentEvent e)
Called when a component event is dispatched and component events are enabled.
protected void
processEvent(AWTEvent e)
Processes the specified event.
protected void
processFocusEvent(FocusEvent e)
Called when a focus event is dispatched and component events are enabled.
protected void
processHierarchyBoundsEvent(HierarchyEvent e)
Called when a hierarchy bounds event is dispatched and component events are enabled.
protected void
processHierarchyEvent(HierarchyEvent e)
Called when a hierarchy change event is dispatched and component events are enabled.
protected void
processInputMethodEvent(InputMethodEvent e)
Called when an input method event is dispatched and component events are enabled.
protected void
processKeyEvent(KeyEvent e)
Called when a key event is dispatched and component events are enabled.
protected void
processMouseEvent(MouseEvent e)
Called when a regular mouse event is dispatched and component events are enabled.
protected void
processMouseMotionEvent(MouseEvent e)
Called when a mouse motion event is dispatched and component events are enabled.
protected void
processMouseWheelEvent(MouseWheelEvent e)
Called when a mouse wheel event is dispatched and component events are enabled.
void
remove(MenuComponent popup)
Removes the specified popup menu from this component.
void
removeComponentListener(ComponentListener listener)
Removes the specified listener from the component.
void
removeFocusListener(FocusListener listener)
Removes the specified listener from the component.
void
removeHierarchyBoundsListener(HierarchyBoundsListener listener)
Removes the specified listener from the component.
void
removeHierarchyListener(HierarchyListener listener)
Removes the specified listener from the component.
void
removeInputMethodListener(InputMethodListener listener)
Removes the specified listener from the component.
void
removeKeyListener(KeyListener listener)
Removes the specified listener from the component.
void
removeMouseListener(MouseListener listener)
Removes the specified listener from the component.
void
removeMouseMotionListener(MouseMotionListener listener)
Removes the specified listener from the component.
void
removeMouseWheelListener(MouseWheelListener listener)
Removes the specified listener from the component.
void
removeNotify()
Called to inform this component is has been removed from its container.
void
removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified property listener from the component.
void
removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
Removes the specified property listener on a particular property from the component.
void
repaint()
Repaint this entire component.
void
repaint(int x, int y, int w, int h)
Repaints the specified rectangular region within this component.
void
repaint(long tm)
Repaint this entire component.
void
repaint(long tm, int x, int y, int width, int height)
Repaints the specified rectangular region within this component.
void
requestFocus()
Request that this Component be given the keyboard input focus and that its top-level ancestor become the focused Window.
protected boolean
requestFocus(boolean temporary)
Request that this Component be given the keyboard input focus and that its top-level ancestor become the focused Window.
boolean
requestFocusInWindow()
Request that this component be given the keyboard input focus, if its top-level ancestor is the currently focused Window.
protected boolean
requestFocusInWindow(boolean temporary)
Request that this component be given the keyboard input focus, if its top-level ancestor is the currently focused Window.
void
reshape(int x, int y, int width, int height)
Deprecated. use setBounds(int,int,int,int) instead
void
resize(int width, int height)
Deprecated. use setSize(int,int) instead
void
resize(Dimension d)
Deprecated. use setSize(Dimension) instead
void
setBackground(Color c)
Sets this component's background color to the specified color.
void
setBounds(int x, int y, int w, int h)
Sets the bounding rectangle for this component to the specified values.
void
setBounds(Rectangle r)
Sets the bounding rectangle for this component to the specified rectangle.
void
setComponentOrientation(ComponentOrientation o)
Sets the text layout orientation of this component.
void
setCursor(Cursor cursor)
Sets the cursor for this component to the specified cursor.
void
setDropTarget(DropTarget dt)
Set the associated drag-and-drop target, which receives events when this is enabled.
void
setEnabled(boolean enabled)
Enables or disables this component.
void
setFocusTraversalKeys(int id, AWTKeyStroke> keystrokes)
Sets the focus traversal keys for one of the three focus traversal directions supported by Components: KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS.
void
setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled)
Enable or disable focus traversal keys on this Component.
void
setFocusable(boolean focusable)
Specify whether this component can receive focus.
void
setFont(Font f)
Sets the font for this component to the specified font.
void
setForeground(Color c)
Sets this component's foreground color to the specified color.
void
setIgnoreRepaint(boolean ignoreRepaint)
Sets whether paint messages delivered by the operating system should be ignored.
void
setLocale(Locale newLocale)
Sets the locale for this component to the specified locale.
void
setLocation(int x, int y)
Moves this component to the specified location, relative to the parent's coordinates.
void
setLocation(Point p)
Moves this component to the specified location, relative to the parent's coordinates.
void
setMaximumSize(Dimension size)
Sets the maximum size that will be returned by getMaximumSize() always, and sends a PropertyChangeEvent (with the property name 'maximumSize') to all registered listeners.
void
setMinimumSize(Dimension size)
Sets the minimum size that will be returned by getMinimumSize() always, and sends a PropertyChangeEvent (with the property name 'minimumSize') to all registered listeners.
void
setName(String name)
Sets the name of this component to the specified name (this is a bound property with the name 'name').
void
setPreferredSize(Dimension size)
Sets the preferred size that will be returned by getPreferredSize() always, and sends a PropertyChangeEvent (with the property name 'preferredSize') to all registered listeners.
void
setSize(int width, int height)
Sets the size of this component to the specified width and height.
void
setSize(Dimension d)
Sets the size of this component to the specified value.
void
setVisible(boolean visible)
Makes this component visible or invisible.
void
show()
Deprecated. use setVisible(boolean) instead
void
show(boolean visible)
Deprecated. use setVisible(boolean) instead
Dimension
size()
Deprecated. use getSize() instead
String
toString()
Returns a string representation of this component.
void
transferFocus()
Transfers focus to the next component in the focus traversal order, as though this were the current focus owner.
void
transferFocusBackward()
Transfers focus to the previous component in the focus traversal order, as though this were the current focus owner.
void
transferFocusUpCycle()
Transfers focus to the focus cycle root of this component.
void
update(Graphics g)
Updates this component.
void
validate()
Called to ensure that the layout for this component is valid.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

BOTTOM_ALIGNMENT

public static final float BOTTOM_ALIGNMENT
Constant returned by the getAlignmentY method to indicate that the component wishes to be aligned to the bottom relative to other components.
Field Value:
1.0f

CENTER_ALIGNMENT

public static final float CENTER_ALIGNMENT
Constant returned by the getAlignmentY and getAlignmentX methods to indicate that the component wishes to be aligned to the center relative to other components.
Field Value:
0.0f

LEFT_ALIGNMENT

public static final float LEFT_ALIGNMENT
Constant returned by the getAlignmentX method to indicate that the component wishes to be aligned to the left relative to other components.
Field Value:
0.0f

RIGHT_ALIGNMENT

public static final float RIGHT_ALIGNMENT
Constant returned by the getAlignmentX method to indicate that the component wishes to be aligned to the right relative to other components.
Field Value:
1.0f

TOP_ALIGNMENT

public static final float TOP_ALIGNMENT
Constant returned by the getAlignmentY method to indicate that the component wishes to be aligned to the top relative to other components.
Field Value:
0.0f

Constructor Details

Component

protected Component()
Default constructor for subclasses. When Component is extended directly, it forms a lightweight component that must be hosted in an opaque native container higher in the tree.

Method Details

action

public boolean action(Event evt,
                      Object what)

Deprecated. in classes which support actions, use processActionEvent(ActionEvent) instead

AWT 1.0 ACTION_EVENT event handler. This method is meant to be overridden by components providing their own action event handler. The default implementation simply returns false.
Parameters:
evt - the event to handle
what - the object acted on, ignored
Returns:
false

add

public void add(PopupMenu popup)
Adds the specified popup menu to this component.
Parameters:
popup - the popup menu to be added
Since:
1.1

addComponentListener

public void addComponentListener(ComponentListener listener)
Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.
Parameters:
listener - the new listener to add
Since:
1.1

addFocusListener

public void addFocusListener(FocusListener listener)
Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.
Parameters:
listener - the new listener to add
Since:
1.1

addHierarchyBoundsListener

public void addHierarchyBoundsListener(HierarchyBoundsListener listener)
Adds the specified listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice.
Parameters:
listener - the new listener to add
Since:
1.3

addHierarchyListener

public void addHierarchyListener(