All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.Component

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

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


Variable Index

 o componentListener
 o focusListener
 o keyListener
 o locale
The locale for the component.
 o LOCK
The locking object for AWT component-tree and layout operations.
 o mouseListener
 o mouseMotionListener
 o newEventsOnly

Method Index

 o action(Event, Object)
DEPRECATED: Replaced by processActionEvent(KeyEvent e); Called if an action occurs in the Component.
 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 the peer should be created.
 o bounds()
DEPRECATED: Replaced by getBounds().
 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: replaced by dispatchEvent(AWTEvent e)
 o disable()
DEPRECATED: Replaced by setEnabled(boolean).
 o disableEvents(long)
Disables the events defined by the specified event mask parameter from being delivered to this component.
 o doLayout()
Lays out the component.
 o enable()
DEPRECATED: Replaced by setEnabled(boolean).
 o enable(boolean)
DEPRECATED: Replaced by setEnabled(boolean).
 o enableEvents(long)
Enables the events defined by the specified event mask parameter to be delivered to this component.
 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 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 gotFocus(Event, Object)
DEPRECATED: Replaced by processFocusEvent(FocusEvent e); Indicates that this component has received the input focus.
 o handleEvent(Event)
DEPRECATED: Replaced by processEvent(AWTEvent e); Handles the event.
 o hide()
DEPRECATED: Replaced by setVisible(boolean).
 o imageUpdate(Image, int, int, int, int, int)
Repaints the component when the image has changed.
 o inside(int, int)
DEPRECATED: Replaced by contains(int, int).
 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: Replaced by processKeyEvent(KeyEvent e); Called if a character is pressed.
 o keyUp(Event, int)
DEPRECATED: Replaced by processKeyEvent(KeyEvent e); Called if a character is released.
 o layout()
DEPRECATED: Replaced by doLayout().
 o list()
Prints a listing to a print stream.
 o list(PrintStream)
Prints a listing to the specified print out stream.
 o list(PrintStream, int)
Prints out a list, starting at the specified indention, to the specified print stream.
 o locate(int, int)
DEPRECATED: Replaced by getComponentAt(int, int).
 o location()
DEPRECATED: Replaced by getLocation().
 o lostFocus(Event, Object)
DEPRECATED: Replaced by processFocusEvent(FocusEvent e); Indicates that this component has lost the input focus.
 o minimumSize()
DEPRECATED: Replaced by getMinimumSize().
 o mouseDown(Event, int, int)
DEPRECATED: Replaced by processMouseEvent(MouseEvent e); Called if the mouse is down.
 o mouseDrag(Event, int, int)
DEPRECATED: Replaced by processMouseMotionEvent(MouseEvent e); Called if the mouse is dragged (the mouse button is down).
 o mouseEnter(Event, int, int)
DEPRECATED: Replaced by processMouseEvent(MouseEvent e); Called when the mouse enters the component.
 o mouseExit(Event, int, int)
DEPRECATED: Replaced by processMouseEvent(MouseEvent e); Called when the mouse exits the component.
 o mouseMove(Event, int, int)
DEPRECATED: Replaced by processMouseMotionEvent(MouseEvent e); Called if the mouse moves (the mouse button is up).
 o mouseUp(Event, int, int)
DEPRECATED: Replaced by processMouseEvent(MouseEvent e); Called if the mouse is up.
 o move(int, int)
DEPRECATED: Replaced by setLocation(int, int).
 o nextFocus()
DEPRECATED: Replaced by transferFocus().
 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: Replaced by dispatchEvent(AWTEvent e); Posts an event to this component.
 o preferredSize()
DEPRECATED: Replaced by getPreferredSize().
 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 it needs to destroy the peer.
 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: Replaced by setBounds(int, int, int, int).
 o resize(Dimension)
DEPRECATED: Replaced by setSize(Dimension).
 o resize(int, int)
DEPRECATED: Replaced by setSize(int, int).
 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: Replaced by setVisible(boolean).
 o show(boolean)
DEPRECATED: Replaced by setVisible(boolean).
 o size()
DEPRECATED: Replaced by getSize().
 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 locale
  protected Locale locale
The locale for the component.

See Also:
getLocale
 o LOCK
  public final static Object LOCK
The locking object for AWT component-tree and layout operations. NOTE: This may need to remain public, not only for access from peer code but also from application code that wishes to always acquire locks in the same order.

 o newEventsOnly
  protected boolean newEventsOnly
 o componentListener
  protected ComponentListener componentListener
 o focusListener
  protected FocusListener focusListener
 o keyListener
  protected KeyListener keyListener
 o mouseListener
  protected MouseListener mouseListener
 o mouseMotionListener
  protected MouseMotionListener mouseMotionListener

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()
DEPRECATED

 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()
DEPRECATED: Replaced by setEnabled(boolean).

 o enable
  public void enable(boolean b)
DEPRECATED: Replaced by setEnabled(boolean).

 o disable
  public void disable()
DEPRECATED: 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()
DEPRECATED: Replaced by setVisible(boolean).

 o show
  public void show(boolean b)
DEPRECATED: Replaced by setVisible(boolean).

 o hide
  public void hide()
DEPRECATED: 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 location
  public Point location()
DEPRECATED: 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)
DEPRECATED: 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()
DEPRECATED: 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:
size, setBounds
 o resize
  public void resize(int width,
                     int height)
DEPRECATED: 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:
size, setBounds
 o resize
  public void resize(Dimension d)
DEPRECATED: Replaced by setSize(Dimension).

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

See Also:
setBounds
 o bounds
  public Rectangle bounds()
DEPRECATED: 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)
DEPRECATED: 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()
DEPRECATED: Replaced by getPreferredSize().

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

See Also:
getPreferredSize, LayoutManager
 o minimumSize
  public Dimension minimumSize()
DEPRECATED: Replaced by getMinimumSize().

 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()
DEPRECATED: 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, layout, 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, layout, 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.

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)
DEPRECATED: 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)
DEPRECATED: 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)
DEPRECATED: replaced by dispatchEvent(AWTEvent e)

 o postEvent
  public boolean postEvent(Event e)
DEPRECATED: Replaced by dispatchEvent(AWTEvent e); Posts an event to this component. This will result in a call to handleEvent. If handleEvent returns false the event is passed on to the parent of this component.

Parameters:
e - the event
See Also:
handleEvent, deliverEvent
 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.

Parameters:
e - the event
See Also:
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()

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()

Parameters:
e - the focus event
 o processKeyEvent
  protected boolean processKeyEvent(KeyEvent e)
Processes key events occurring on this component by dispatching them to any registered KeyListener objects. Returns true if the event is not to be passed on to the peer (to consume the event), returns false if the event should be sent and processed by the peer. By default this method returns false. 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()

Parameters:
e - the key event
 o processMouseEvent
  protected boolean processMouseEvent(MouseEvent e)
Processes mouse events occurring on this component by dispatching them to any registered MouseListener objects. Returns true if the event is not to be passed on to the peer (to consume the event), returns false if the event should be sent and processed by the peer. By default this method returns false. 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()

Parameters:
e - the mouse event
 o processMouseMotionEvent
  protected boolean processMouseMotionEvent(MouseEvent e)
Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects. Returns true if the event is not to be passed on to the peer (to consume the event), returns false if the event should be sent and processed by the peer. By default this method returns false. 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()

Parameters:
e - the mouse motion event
 o handleEvent
  public boolean handleEvent(Event evt)
DEPRECATED: Replaced by processEvent(AWTEvent e); Handles the event. Returns true if the event is handled and should not be passed to the parent of this component. The default event handler calls some helper methods to make life easier on the programmer.

Parameters:
evt - the event
See Also:
mouseEnter, mouseExit, mouseMove, mouseDown, mouseDrag, mouseUp, keyDown, action
 o mouseDown
  public boolean mouseDown(Event evt,
                           int x,
                           int y)
DEPRECATED: Replaced by processMouseEvent(MouseEvent e); Called if the mouse is down.

Parameters:
evt - the event
x - the x coordinate
y - the y coordinate
See Also:
handleEvent
 o mouseDrag
  public boolean mouseDrag(Event evt,
                           int x,
                           int y)
DEPRECATED: Replaced by processMouseMotionEvent(MouseEvent e); Called if the mouse is dragged (the mouse button is down).

Parameters:
evt - the event
x - the x coordinate
y - the y coordinate
See Also:
handleEvent
 o mouseUp
  public boolean mouseUp(Event evt,
                         int x,
                         int y)
DEPRECATED: Replaced by processMouseEvent(MouseEvent e); Called if the mouse is up.

Parameters:
evt - the event
x - the x coordinate
y - the y coordinate
See Also:
handleEvent
 o mouseMove
  public boolean mouseMove(Event evt,
                           int x,
                           int y)
DEPRECATED: Replaced by processMouseMotionEvent(MouseEvent e); Called if the mouse moves (the mouse button is up).

Parameters:
evt - the event
x - the x coordinate
y - the y coordinate
See Also:
handleEvent
 o mouseEnter
  public boolean mouseEnter(Event evt,
                            int x,
                            int y)
DEPRECATED: Replaced by processMouseEvent(MouseEvent e); Called when the mouse enters the component.

Parameters:
evt - the event
x - the x coordinate
y - the y coordinate
See Also:
handleEvent
 o mouseExit
  public boolean mouseExit(Event evt,
                           int x,
                           int y)
DEPRECATED: Replaced by processMouseEvent(MouseEvent e); Called when the mouse exits the component.

Parameters:
evt - the event
x - the x coordinate
y - the y coordinate
See Also:
handleEvent
 o keyDown
  public boolean keyDown(Event evt,
                         int key)
DEPRECATED: Replaced by processKeyEvent(KeyEvent e); Called if a character is pressed.

Parameters:
evt - the event
key - the key that's pressed
See Also:
handleEvent
 o keyUp
  public boolean keyUp(Event evt,
                       int key)
DEPRECATED: Replaced by processKeyEvent(KeyEvent e); Called if a character is released.

Parameters:
evt - the event
key - the key that's released
See Also:
handleEvent
 o action
  public boolean action(Event evt,
                        Object what)
DEPRECATED: Replaced by processActionEvent(KeyEvent e); Called if an action occurs in the Component.

Parameters:
evt - the event
what - the action that's occuring
See Also:
handleEvent
 o addNotify
  public void addNotify()
Notifies the Component that it has been added to a container and the peer 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 it needs to destroy the peer. 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)
DEPRECATED: Replaced by processFocusEvent(FocusEvent e); Indicates that this component has received the input focus.

See Also:
requestFocus, lostFocus
 o lostFocus
  public boolean lostFocus(Event evt,
                           Object what)
DEPRECATED: Replaced by processFocusEvent(FocusEvent e); Indicates that this component has lost the input focus.

See Also:
requestFocus, gotFocus
 o requestFocus
  public void requestFocus()
Requests the input focus. The gotFocus() method will be called if this method is successful. The component must be visible on the screen for this request to be granted.

See Also:
gotFocus
 o transferFocus
  public void transferFocus()
Transfers the focus to the next component.

See Also:
requestFocus, gotFocus
 o nextFocus
  public void nextFocus()
DEPRECATED: 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 a print stream.

 o list
  public void list(PrintStream out)
Prints a listing to the specified print out 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 isFocusTraversable
  public boolean isFocusTraversable()
Returns whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal.


All Packages  Class Hierarchy  This Package  Previous  Next  Index