All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.Component

java.lang.Object
   |
   +----java.awt.Component

public abstract class Component
extends Object
implements ImageObserver, MenuContainer, Serializable
A generic Abstract Window Toolkit component.


Variable Index

 o BOTTOM_ALIGNMENT
Ease of use constant for getAlignmentY().
 o CENTER_ALIGNMENT
Ease of use constant for getAlignmentY() and getAlignmentX().
 o LEFT_ALIGNMENT
Ease of use constant for getAlignmentX().
 o RIGHT_ALIGNMENT
Ease of use constant for getAlignmentX().
 o TOP_ALIGNMENT
Ease of use constant for getAlignmentY().

Constructor Index

 o Component()
Constructs a new Component.

Method Index

 o action(Event, Object)
Deprecated.
 o add(PopupMenu)
Adds the specified popup menu to the component.
 o addComponentListener(ComponentListener)
Adds the specified component listener to receive component events from this component.
 o addFocusListener(FocusListener)
Adds the specified focus listener to receive focus events from this component.
 o addKeyListener(KeyListener)
Adds the specified key listener to receive key events from this component.
 o addMouseListener(MouseListener)
Adds the specified mouse listener to receive mouse events from this component.
 o addMouseMotionListener(MouseMotionListener)
Adds the specified mouse motion listener to receive mouse motion events from this component.
 o addNotify()
Notifies the Component that it has been added to a container and if a peer is required, it should be created.
 o bounds()
Deprecated.
 o checkImage(Image, ImageObserver)
Returns the status of the construction of a screen representation of the specified image.
 o checkImage(Image, int, int, ImageObserver)
Returns the status of the construction of a scaled screen representation of the specified image.
 o contains(int, int)
Checks whether this component "contains" the specified (x, y) location, where x and y are defined to be relative to the coordinate system of this component.
 o contains(Point)
Checks whether this component "contains" the specified point, where x and y in the point are defined to be relative to the coordinate system of this component.
 o createImage(ImageProducer)
Creates an image from the specified image producer.
 o createImage(int, int)
Creates an off-screen drawable Image to be used for double buffering.
 o deliverEvent(Event)
Deprecated.
 o disable()
Deprecated.
 o disableEvents(long)
Disables the events defined by the specified event mask parameter from being delivered to this component.
 o dispatchEvent(AWTEvent)
Dispatches an event to this component or one of its sub components.
 o doLayout()
Lays out the component.
 o enable()
Deprecated.
 o enable(boolean)
Deprecated.
 o enableEvents(long)
Enables the events defined by the specified event mask parameter to be delivered to this component.
 o getAlignmentX()
Returns the alignment along the x axis.
 o getAlignmentY()
Returns the alignment along the y axis.
 o getBackground()
Gets the background color.
 o getBounds()
Returns the current bounds of this component.
 o getColorModel()
Gets the ColorModel used to display the component on the output device.
 o getComponentAt(int, int)
Returns the component or subcomponent that contains the x,y location.
 o getComponentAt(Point)
Returns the component or subcomponent that contains the specified point.
 o getCursor()
Gets the cursor set on this component.
 o getFont()
Gets the font of the component.
 o getFontMetrics(Font)
Gets the font metrics for this component.
 o getForeground()
Gets the foreground color.
 o getGraphics()
Gets a Graphics context for this component.
 o getLocale()
Gets the locale of the component.
 o getLocation()
Returns the current location of this component.
 o getLocationOnScreen()
Returns the current location of this component in the screen's coordinate space.
 o getMaximumSize()
Returns the maximum size of this component.
 o getMinimumSize()
Returns the mininimum size of this component.
 o getName()
Gets the name of the component.
 o getParent()
Gets the parent of the component.
 o getPeer()
Deprecated.
 o getPreferredSize()
Returns the preferred size of this component.
 o getSize()
Returns the current size of this component.
 o getToolkit()
Gets the toolkit of the component.
 o getTreeLock()
Gets the locking object for AWT component-tree and layout operations.
 o gotFocus(Event, Object)
Deprecated.
 o handleEvent(Event)
Deprecated.
 o hide()
Deprecated.
 o imageUpdate(Image, int, int, int, int, int)
Repaints the component when the image has changed.
 o inside(int, int)
Deprecated.
 o invalidate()
Invalidates the component.
 o isEnabled()
Checks if this Component is enabled.
 o isFocusTraversable()
Returns whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal.
 o isShowing()
Checks if this Component is showing on screen.
 o isValid()
Checks if this Component is valid.
 o isVisible()
Checks if this Component is visible.
 o keyDown(Event, int)
Deprecated.
 o keyUp(Event, int)
Deprecated.
 o layout()
Deprecated.
 o list()
Prints a listing to System.out.
 o list(PrintStream)
Prints a listing to the specified print stream.
 o list(PrintStream, int)
Prints out a list, starting at the specified indention, to the specified print stream.
 o list(PrintWriter)
Prints a listing to the specified print writer.
 o list(PrintWriter, int)
Prints out a list, starting at the specified indention, to the specified print writer.
 o locate(int, int)
Deprecated.
 o location()
Deprecated.
 o lostFocus(Event, Object)
Deprecated.
 o minimumSize()
Deprecated.
 o mouseDown(Event, int, int)
Deprecated.
 o mouseDrag(Event, int, int)
Deprecated.
 o mouseEnter(Event, int, int)
Deprecated.
 o mouseExit(Event, int, int)
Deprecated.
 o mouseMove(Event, int, int)
Deprecated.
 o mouseUp(Event, int, int)
Deprecated.
 o move(int, int)
Deprecated.
 o nextFocus()
Deprecated.
 o paint(Graphics)
Paints the component.
 o paintAll(Graphics)
Paints the component and its subcomponents.
 o paramString()
Returns the parameter String of this Component.
 o postEvent(Event)
Deprecated.
 o preferredSize()
Deprecated.
 o prepareImage(Image, ImageObserver)
Prepares an image for rendering on this Component.
 o prepareImage(Image, int, int, ImageObserver)
Prepares an image for rendering on this Component at the specified width and height.
 o print(Graphics)
Prints this component.
 o printAll(Graphics)
Prints the component and its subcomponents.
 o processComponentEvent(ComponentEvent)
Processes component events occurring on this component by dispatching them to any registered ComponentListener objects.
 o processEvent(AWTEvent)
Processes events occurring on this component.
 o processFocusEvent(FocusEvent)
Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.
 o processKeyEvent(KeyEvent)
Processes key events occurring on this component by dispatching them to any registered KeyListener objects.
 o processMouseEvent(MouseEvent)
Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects.
 o processMouseMotionEvent(MouseEvent)
Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects.
 o remove(MenuComponent)
Removes the specified popup menu from the component.
 o removeComponentListener(ComponentListener)
Removes the specified listener so it no longer receives component events from this component.
 o removeFocusListener(FocusListener)
Removes the specified focus listener so it no longer receives focus events from this component.
 o removeKeyListener(KeyListener)
Removes the specified key listener so it no longer receives key events from this component.
 o removeMouseListener(MouseListener)
Removes the specified mouse listener so it no longer receives mouse events from this component.
 o removeMouseMotionListener(MouseMotionListener)
Removes the specified mouse motion listener so it no longer receives mouse motion events from this component.
 o removeNotify()
Notifies the Component that it has been removed from its container and if a peers ecists, it destroys it.
 o repaint()
Repaints the component.
 o repaint(int, int, int, int)
Repaints part of the component.
 o repaint(long)
Repaints the component.
 o repaint(long, int, int, int, int)
Repaints part of the component.
 o requestFocus()
Requests the input focus.
 o reshape(int, int, int, int)
Deprecated.
 o resize(Dimension)
Deprecated.
 o resize(int, int)
Deprecated.
 o setBackground(Color)
Sets the background color.
 o setBounds(int, int, int, int)
Reshapes the Component to the specified bounding box.
 o setBounds(Rectangle)
Reshapes the Component to the specified bounding box.
 o setCursor(Cursor)
Set the cursor image to a predefined cursor.
 o setEnabled(boolean)
Enables a component.
 o setFont(Font)
Sets the font of the component.
 o setForeground(Color)
Sets the foreground color.
 o setLocale(Locale)
Sets the locale of the component.
 o setLocation(int, int)
Moves the Component to a new location.
 o setLocation(Point)
Moves the Component to a new location.
 o setName(String)
Sets the name of the component to the specified string.
 o setSize(Dimension)
Resizes the Component to the specified dimension.
 o setSize(int, int)
Resizes the Component to the specified width and height.
 o setVisible(boolean)
Shows or hides the component depending on the boolean flag b.
 o show()
Deprecated.
 o show(boolean)
Deprecated.
 o size()
Deprecated.
 o toString()
Returns the String representation of this Component's values.
 o transferFocus()
Transfers the focus to the next component.
 o update(Graphics)
Updates the component.
 o validate()
Ensures that a component has a valid layout.

Variables

 o TOP_ALIGNMENT
 public static final float TOP_ALIGNMENT
Ease of use constant for getAlignmentY(). Specifies an alignment to the top of the component.

 o CENTER_ALIGNMENT
 public static final float CENTER_ALIGNMENT
Ease of use constant for getAlignmentY() and getAlignmentX(). Specifies an alignment to the center of the component.

 o BOTTOM_ALIGNMENT
 public static final float BOTTOM_ALIGNMENT
Ease of use constant for getAlignmentY(). Specifies an alignment to the bottom of the component.

 o LEFT_ALIGNMENT
 public static final float LEFT_ALIGNMENT
Ease of use constant for getAlignmentX(). Specifies an alignment to the left side of the component.

 o RIGHT_ALIGNMENT
 public static final float RIGHT_ALIGNMENT
Ease of use constant for getAlignmentX(). Specifies an alignment to the right side of the component.

Constructors

 o Component
 protected Component()
Constructs a new Component. Components can be extended directly, but are lightweight in this case and must be hosted by a native container somewhere higher up in the component tree (such as a Frame for example).

Methods

 o getName
 public String getName()
Gets the name of the component.

 o setName
 public void setName(String name)
Sets the name of the component to the specified string.

Parameters:
name - the name of the component.
 o getParent
 public Container getParent()
Gets the parent of the component.

 o getPeer
 public ComponentPeer getPeer()
Note: getPeer() is deprecated. As of JDK version 1.1, programs should not directly manipulate peers.

 o getTreeLock
 public final Object getTreeLock()
Gets the locking object for AWT component-tree and layout operations.

 o getToolkit
 public Toolkit getToolkit()
Gets the toolkit of the component. This toolkit is used to create the peer for this component. Note that the Frame which contains a Component controls which toolkit is used so if the Component has not yet been added to a Frame or if it is later moved to a different Frame, the toolkit it uses may change.

 o isValid
 public boolean isValid()
Checks if this Component is valid. Components are invalidated when they are first shown on the screen.

See Also:
validate, invalidate
 o isVisible
 public boolean isVisible()
Checks if this Component is visible. Components are initially visible (with the exception of top level components such as Frame).

See Also:
setVisible
 o isShowing
 public boolean isShowing()
Checks if this Component is showing on screen. This means that the component must be visible, and it must be in a container that is visible and showing.

See Also:
setVisible
 o isEnabled
 public boolean isEnabled()
Checks if this Component is enabled. Components are initially enabled.

See Also:
setEnabled
 o setEnabled
 public void setEnabled(boolean b)
Enables a component.

See Also:
isEnabled
 o enable
 public void enable()
Note: enable() is deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).

 o enable
 public void enable(boolean b)
Note: enable() is deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).

 o disable
 public void disable()
Note: disable() is deprecated. As of JDK version 1.1, replaced by setEnabled(boolean).

 o setVisible
 public void setVisible(boolean b)
Shows or hides the component depending on the boolean flag b.

Parameters:
b - if true, show the component; otherwise, hide the component.
See Also:
isVisible
 o show
 public void show()
Note: show() is deprecated. As of JDK version 1.1, replaced by setVisible(boolean).

 o show
 public void show(boolean b)
Note: show() is deprecated. As of JDK version 1.1, replaced by setVisible(boolean).

 o hide
 public void hide()
Note: hide() is deprecated. As of JDK version 1.1, replaced by setVisible(boolean).

 o getForeground
 public Color getForeground()
Gets the foreground color. If the component does not have a foreground color, the foreground color of its parent is returned.

See Also:
setForeground
 o setForeground
 public void setForeground(Color c)
Sets the foreground color.

Parameters:
c - the Color
See Also:
getForeground
 o getBackground
 public Color getBackground()
Gets the background color. If the component does not have a background color, the background color of its parent is returned.

See Also:
setBackground
 o setBackground
 public void setBackground(Color c)
Sets the background color.

Parameters:
c - the Color
See Also:
getBackground
 o getFont
 public Font getFont()
Gets the font of the component. If the component does not have a font, the font of its parent is returned.

See Also:
setFont
 o setFont
 public synchronized void setFont(Font f)
Sets the font of the component.

Parameters:
f - the font
See Also:
getFont
 o getLocale
 public Locale getLocale()
Gets the locale of the component. If the component does not have a locale, the locale of its parent is returned.

Throws: IllegalComponentStateException
If the Component does not have its own locale and has not yet been added to a containment hierarchy such that the locale can be determined from the containing parent.
See Also:
setLocale
 o setLocale
 public void setLocale(Locale l)
Sets the locale of the component.

Parameters:
l - the locale
See Also:
getLocale
 o getColorModel
 public ColorModel getColorModel()
Gets the ColorModel used to display the component on the output device.

See Also:
ColorModel
 o getLocation
 public Point getLocation()
Returns the current location of this component. The location will be in the parent's coordinate space.

See Also:
setLocation
 o getLocationOnScreen
 public Point getLocationOnScreen()
Returns the current location of this component in the screen's coordinate space.

See Also:
setLocation, getLocation
 o location
 public Point location()
Note: location() is deprecated. As of JDK version 1.1, replaced by getLocation().

 o setLocation
 public void setLocation(int x,
                         int y)
Moves the Component to a new location. The x and y coordinates are in the parent's coordinate space.

Parameters:
x - the x coordinate
y - the y coordinate
See Also:
getLocation, setBounds
 o move
 public void move(int x,
                  int y)
Note: move() is deprecated. As of JDK version 1.1, replaced by setLocation(int, int).

 o setLocation
 public void setLocation(Point p)
Moves the Component to a new location. The point p is given in the parent's coordinate space.

Parameters:
p - the new location for the coordinate
See Also:
getLocation, setBounds
 o getSize
 public Dimension getSize()
Returns the current size of this component.

See Also:
setSize
 o size
 public Dimension size()
Note: size() is deprecated. As of JDK version 1.1, replaced by getSize().

 o setSize
 public void setSize(int width,
                     int height)
Resizes the Component to the specified width and height.

Parameters:
width - the width of the component
height - the height of the component
See Also:
getSize, setBounds
 o resize
 public void resize(int width,
                    int height)
Note: resize() is deprecated. As of JDK version 1.1, replaced by setSize(int, int).

 o setSize
 public void setSize(Dimension d)
Resizes the Component to the specified dimension.

Parameters:
d - the component dimension
See Also:
setSize, setBounds
 o resize
 public void resize(Dimension d)
Note: resize() is deprecated. As of JDK version 1.1, replaced by setSize(Dimension).

 o getBounds
 public Rectangle getBounds()
Returns the current bounds of this component.

See Also:
setBounds
 o bounds
 public Rectangle bounds()
Note: bounds() is deprecated. As of JDK version 1.1, replaced by getBounds().

 o setBounds
 public void setBounds(int x,
                       int y,
                       int width,
                       int height)
Reshapes the Component to the specified bounding box.

Parameters:
x - the x coordinate
y - the y coordinate
width - the width of the component
height - the height of the component
See Also:
getBounds, setLocation, setSize
 o reshape
 public void reshape(int x,
                     int y,
                     int width,
                     int height)
Note: reshape() is deprecated. As of JDK version 1.1, replaced by setBounds(int, int, int, int).

 o setBounds
 public void setBounds(Rectangle r)
Reshapes the Component to the specified bounding box.

Parameters:
r - the new bounding rectangle for the component
See Also:
getBounds, setLocation, setSize
 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred size of this component.

See Also:
getMinimumSize, LayoutManager
 o preferredSize
 public Dimension preferredSize()
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().

 o getMinimumSize
 public Dimension getMinimumSize()
Returns the mininimum size of this component.

See Also:
getPreferredSize, LayoutManager
 o minimumSize
 public Dimension minimumSize()
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().

 o getMaximumSize
 public Dimension getMaximumSize()
Returns the maximum size of this component.

See Also:
getMinimumSize, getPreferredSize, LayoutManager
 o getAlignmentX
 public float getAlignmentX()
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

 o getAlignmentY
 public float getAlignmentY()
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

 o doLayout
 public void doLayout()
Lays out the component. This is usually called when the component (more specifically, container) is validated.

See Also:
validate, LayoutManager
 o layout
 public void layout()
Note: layout() is deprecated. As of JDK version 1.1, replaced by doLayout().

 o validate
 public void validate()
Ensures that a component has a valid layout. This method is primarily intended to operate on Container instances.

See Also:
invalidate, doLayout, LayoutManager, validate
 o invalidate
 public void invalidate()
Invalidates the component. The component and all parents above it are marked as needing to be laid out. This method can be called often, so it needs to execute quickly.

See Also:
validate, doLayout, LayoutManager
 o getGraphics
 public Graphics getGraphics()
Gets a Graphics context for this component. This method will return null if the component is currently not on the screen.

See Also:
paint
 o getFontMetrics
 public FontMetrics getFontMetrics(Font font)
Gets the font metrics for this component.

Parameters:
font - the font
See Also:
getFont
 o setCursor
 public synchronized void setCursor(Cursor cursor)
Set the cursor image to a predefined cursor.

Parameters:
cursorType - one of the cursor constants defined above.
See Also:
Cursor
 o getCursor
 public Cursor getCursor()
Gets the cursor set on this component.

 o paint
 public void paint(Graphics g)
Paints the component. This method is called when the contents of the component should be painted in response to the component first being shown or damage needing repair. The clip rectangle in the Graphics parameter will be set to the area which needs to be painted.

Parameters:
g - the specified Graphics window
See Also:
update
 o update
 public void update(Graphics g)
Updates the component. This method is called in response to a call to repaint. You can assume that the background is not cleared.

Parameters:
g - the specified Graphics window
See Also:
paint, repaint
 o paintAll
 public void paintAll(Graphics g)
Paints the component and its subcomponents.

Parameters:
g - the specified Graphics window
See Also:
paint
 o repaint
 public void repaint()
Repaints the component. This will result in a call to update as soon as possible.

See Also:
paint
 o repaint
 public void repaint(long tm)
Repaints the component. This will result in a call to update within tm milliseconds.

Parameters:
tm - maximum time in milliseconds before update
See Also:
paint
 o repaint
 public void repaint(int x,
                     int y,
                     int width,
                     int height)
Repaints part of the component. This will result in a call to update as soon as possible.

Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height
See Also:
repaint
 o repaint
 public void repaint(long tm,
                     int x,
                     int y,
                     int width,
                     int height)
Repaints part of the component. This will result in a call to update width tm millseconds.

Parameters:
tm - maximum time in milliseconds before update
x - the x coordinate
y - the y coordinate
width - the width
height - the height
See Also:
repaint
 o print
 public void print(Graphics g)
Prints this component. The default implementation of this method calls paint.

Parameters:
g - the specified Graphics window
See Also:
paint
 o printAll
 public void printAll(Graphics g)
Prints the component and its subcomponents.

Parameters:
g - the specified Graphics window
See Also:
print
 o imageUpdate
 public boolean imageUpdate(Image img,
                            int flags,
                            int x,
                            int y,
                            int w,
                            int h)
Repaints the component when the image has changed.

Returns:
true if image has changed; false otherwise.
 o createImage
 public Image createImage(ImageProducer producer)
Creates an image from the specified image producer.

Parameters:
producer - the image producer
 o createImage
 public Image createImage(int width,
                          int height)
Creates an off-screen drawable Image to be used for double buffering.

Parameters:
width - the specified width
height - the specified height
 o prepareImage
 public boolean prepareImage(Image image,
                             ImageObserver observer)
Prepares an image for rendering on this Component. The image data is downloaded asynchronously in another thread and the appropriate screen representation of the image is generated.

Parameters:
image - the Image to prepare a screen representation for
observer - the ImageObserver object to be notified as the image is being prepared
Returns:
true if the image has already been fully prepared
See Also:
ImageObserver
 o prepareImage
 public boolean prepareImage(Image image,
                             int width,
                             int height,
                             ImageObserver observer)
Prepares an image for rendering on this Component at the specified width and height. The image data is downloaded asynchronously in another thread and an appropriately scaled screen representation of the image is generated.

Parameters:
image - the Image to prepare a screen representation for
width - the width of the desired screen representation
height - the height of the desired screen representation
observer - the ImageObserver object to be notified as the image is being prepared
Returns:
true if the image has already been fully prepared
See Also:
ImageObserver
 o checkImage
 public int checkImage(Image image,
                       ImageObserver observer)
Returns the status of the construction of a screen representation of the specified image. This method does not cause the image to begin loading. Use the prepareImage method to force the loading of an image.

Parameters:
image - the Image to check the status of
observer - the ImageObserver object to be notified as the image is being prepared
Returns:
the boolean OR of the ImageObserver flags for the data that is currently available
See Also:
ImageObserver, prepareImage
 o checkImage
 public int checkImage(Image image,
                       int width,
                       int height,
                       ImageObserver observer)
Returns the status of the construction of a scaled screen representation of the specified image. This method does not cause the image to begin loading, use the prepareImage method to force the loading of an image.

Parameters:
image - the Image to check the status of
width - the width of the scaled version to check the status of
height - the height of the scaled version to check the status of
observer - the ImageObserver object to be notified as the image is being prepared
Returns:
the boolean OR of the ImageObserver flags for the data that is currently available
See Also:
ImageObserver, prepareImage
 o contains
 public boolean contains(int x,
                         int y)
Checks whether this component "contains" the specified (x, y) location, where x and y are defined to be relative to the coordinate system of this component.

Parameters:
x - the x coordinate
y - the y coordinate
See Also:
getComponentAt
 o inside
 public boolean inside(int x,
                       int y)
Note: inside() is deprecated. As of JDK version 1.1, replaced by contains(int, int).

 o contains
 public boolean contains(Point p)
Checks whether this component "contains" the specified point, where x and y in the point are defined to be relative to the coordinate system of this component.

Parameters:
p - the point
See Also:
getComponentAt
 o getComponentAt
 public Component getComponentAt(int x,
                                 int y)
Returns the component or subcomponent that contains the x,y location.

Parameters:
x - the x coordinate
y - the y coordinate
See Also:
contains
 o locate
 public Component locate(int x,
                         int y)
Note: locate() is deprecated. As of JDK version 1.1, replaced by getComponentAt(int, int).

 o getComponentAt
 public Component getComponentAt(Point p)
Returns the component or subcomponent that contains the specified point.

Parameters:
p - the point
See Also:
contains
 o deliverEvent
 public void deliverEvent(Event e)
Note: deliverEvent() is deprecated. As of JDK version 1.1

 o dispatchEvent
 public final void dispatchEvent(AWTEvent e)
Dispatches an event to this component or one of its sub components.

Parameters:
e - the event
 o postEvent
 public boolean postEvent(Event e)
Note: postEvent() is deprecated. As of JDK version 1.1, replaced by dispatchEvent(AWTEvent).

 o addComponentListener
 public synchronized void addComponentListener(ComponentListener l)
Adds the specified component listener to receive component events from this component.

Parameters:
l - the component listener
 o removeComponentListener
 public synchronized void removeComponentListener(ComponentListener l)
Removes the specified listener so it no longer receives component events from this component.

Parameters:
l - the component listener
 o addFocusListener
 public synchronized void addFocusListener(FocusListener l)
Adds the specified focus listener to receive focus events from this component.

Parameters:
l - the focus listener
 o removeFocusListener
 public synchronized void removeFocusListener(FocusListener l)
Removes the specified focus listener so it no longer receives focus events from this component.

Parameters:
l - the focus listener
 o addKeyListener
 public synchronized void addKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component.

Parameters:
l - the key listener
 o removeKeyListener
 public synchronized void removeKeyListener(KeyListener l)
Removes the specified key listener so it no longer receives key events from this component.

Parameters:
l - the key listener
 o addMouseListener
 public synchronized void addMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this component.

Parameters:
l - the mouse listener
 o removeMouseListener
 public synchronized void removeMouseListener(MouseListener l)
Removes the specified mouse listener so it no longer receives mouse events from this component.

Parameters:
l - the mouse listener
 o addMouseMotionListener
 public synchronized void addMouseMotionListener(MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component.

Parameters:
l - the mouse motion listener
 o removeMouseMotionListener
 public synchronized void removeMouseMotionListener(MouseMotionListener l)
Removes the specified mouse motion listener so it no longer receives mouse motion events from this component.

Parameters:
l - the mouse motion listener
 o enableEvents
 protected final void enableEvents(long eventsToEnable)
Enables the events defined by the specified event mask parameter to be delivered to this component. Event types are automatically enabled when a listener for that type is added to the component, therefore this method only needs to be invoked by subclasses of a component which desire to have the specified event types delivered to processEvent regardless of whether a listener is registered.

Parameters:
eventsToEnable - the event mask defining the event types
 o disableEvents
 protected final void disableEvents(long eventsToDisable)
Disables the events defined by the specified event mask parameter from being delivered to this component.

Parameters:
eventsToDisable - the event mask defining the event types
 o processEvent
 protected void processEvent(AWTEvent e)
Processes events occurring on this component. By default this method will call the appropriate processXXXEvent method for the class of event. This method will not be called unless and event type is enabled for this component; this happens when one of the following occurs: a) A listener object is registered for that event type b) The event type is enabled via enableEvents() Classes overriding this method should call super.processEvent() to ensure default event processing continues normally.

Parameters:
e - the event
See Also:
enableEvents, processComponentEvent, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent
 o processComponentEvent
 protected void processComponentEvent(ComponentEvent e)
Processes component events occurring on this component by dispatching them to any registered ComponentListener objects. NOTE: This method will not be called unless component events are enabled for this component; this happens when one of the following occurs: a) A ComponentListener object is registered via addComponentListner() b) Component events are enabled via enableEvents() Classes overriding this method should call super.processComponentEvent() to ensure default event processing continues normally.

Parameters:
e - the component event
 o processFocusEvent
 protected void processFocusEvent(FocusEvent e)
Processes focus events occurring on this component by dispatching them to any registered FocusListener objects. NOTE: This method will not be called unless focus events are enabled for this component; this happens when one of the following occurs: a) A FocusListener object is registered via addFocusListener() b) Focus events are enabled via enableEvents() Classes overriding this method should call super.processFocusEvent() to ensure default event processing continues normally.

Parameters:
e - the focus event
 o processKeyEvent
 protected void processKeyEvent(KeyEvent e)
Processes key events occurring on this component by dispatching them to any registered KeyListener objects. NOTE: This method will not be called unless key events are enabled for this component; this happens when one of the following occurs: a) A KeyListener object is registered via addKeyListener() b) Key events are enabled via enableEvents() Classes overriding this method should call super.processKeyEvent() to ensure default event processing continues normally.

Parameters:
e - the key event
 o processMouseEvent
 protected void processMouseEvent(MouseEvent e)
Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects. NOTE: This method will not be called unless mouse events are enabled for this component; this happens when one of the following occurs: a) A MouseListener object is registered via addMouseListener() b) Mouse events are enabled via enableEvents() Classes overriding this method should call super.processMouseEvent() to ensure default event processing continues normally.

Parameters:
e - the mouse event
 o processMouseMotionEvent
 protected void processMouseMotionEvent(MouseEvent e)
Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects. NOTE: This method will not be called unless mouse motion events are enabled for this component; this happens when one of the following occurs: a) A MouseMotionListener object is registered via addMouseMotionListener() b) Mouse Motion events are enabled via enableEvents() Classes overriding this method should call super.processMouseMotionEvent() to ensure default event processing continues normally.

Parameters:
e - the mouse motion event
 o handleEvent
 public boolean handleEvent(Event evt)
Note: handleEvent() is deprecated. As of JDK version 1.1 replaced by processEvent(AWTEvent).

 o mouseDown
 public boolean mouseDown(Event evt,
                          int x,
                          int y)
Note: mouseDown() is deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).

 o mouseDrag
 public boolean mouseDrag(Event evt,
                          int x,
                          int y)
Note: mouseDrag() is deprecated. As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).

 o mouseUp
 public boolean mouseUp(Event evt,
                        int x,
                        int y)
Note: mouseUp() is deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).

 o mouseMove
 public boolean mouseMove(Event evt,
                          int x,
                          int y)
Note: mouseMove() is deprecated. As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).

 o mouseEnter
 public boolean mouseEnter(Event evt,
                           int x,
                           int y)
Note: mouseEnter() is deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).

 o mouseExit
 public boolean mouseExit(Event evt,
                          int x,
                          int y)
Note: mouseExit() is deprecated. As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).

 o keyDown
 public boolean keyDown(Event evt,
                        int key)
Note: keyDown() is deprecated. As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).

 o keyUp
 public boolean keyUp(Event evt,
                      int key)
Note: keyUp() is deprecated. As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).

 o action
 public boolean action(Event evt,
                       Object what)
Note: action() is deprecated. As of JDK version 1.1, should register this component as ActionListener on component which fires action events.

 o addNotify
 public void addNotify()
Notifies the Component that it has been added to a container and if a peer is required, it should be created. This method should be called by Container.add, and not by user code directly.

See Also:
removeNotify
 o removeNotify
 public void removeNotify()
Notifies the Component that it has been removed from its container and if a peers ecists, it destroys it. This method should be called by Container.remove, and not by user code directly.

See Also:
addNotify
 o gotFocus
 public boolean gotFocus(Event evt,
                         Object what)
Note: gotFocus() is deprecated. As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).

 o lostFocus
 public boolean lostFocus(Event evt,
                          Object what)
Note: lostFocus() is deprecated. As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).

 o isFocusTraversable
 public boolean isFocusTraversable()
Returns whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal. If this method returns "false", this component may still request the keyboard focus using requestFocus(), but it will not automatically be assigned focus during tab traversal.

 o requestFocus
 public void requestFocus()
Requests the input focus. A FocusGained event will be delivered if this request succeeds. The component must be visible on the screen for this request to be granted.

See Also:
FocusEvent, addFocusListener, processFocusEvent, isFocusTraversable
 o transferFocus
 public void transferFocus()
Transfers the focus to the next component.

See Also:
requestFocus
 o nextFocus
 public void nextFocus()
Note: nextFocus() is deprecated. As of JDK version 1.1, replaced by transferFocus().

 o add
 public synchronized void add(PopupMenu popup)
Adds the specified popup menu to the component.

Parameters:
popup - the popup menu to be added to the component
 o remove
 public synchronized void remove(MenuComponent popup)
Removes the specified popup menu from the component.

Parameters:
popup - the popup menu to be removed
 o paramString
 protected String paramString()
Returns the parameter String of this Component.

 o toString
 public String toString()
Returns the String representation of this Component's values.

Overrides:
toString in class Object
 o list
 public void list()
Prints a listing to System.out.

 o list
 public void list(PrintStream out)
Prints a listing to the specified print stream.

Parameters:
out - the Stream name
 o list
 public void list(PrintStream out,
                  int indent)
Prints out a list, starting at the specified indention, to the specified print stream.

Parameters:
out - the Stream name
indent - the start of the list
 o list
 public void list(PrintWriter out)
Prints a listing to the specified print writer.

 o list
 public void list(PrintWriter out,
                  int indent)
Prints out a list, starting at the specified indention, to the specified print writer.


All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature