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