Component

Name

Component

[Graphic: Figure from the text]

Description

The Component class is the parent of all non-menu GUI components.

Class Definition

public abstract class java.awt.Component extends java.lang.Object implements java.awt.image.ImageObserver implements java.awt.MenuContainer implements java.io.Serializable {
 // Constants public final static float BOTTOM_ALIGNMENT; public final static float CENTER_ALIGNMENT; public final static float LEFT_ALIGNMENT; public final static float RIGHT_ALIGNMENT; public final static float TOP_ALIGNMENT; // Variables protected Locale locale; // Constructors protected Component(); // Instance Methods public boolean action (Event e, Object o); (Deprecated) public synchronized void add (PopupMenu popup); public synchronized void addComponentListener (ComponentListener l); public synchronized void addFocusListener (FocusListener l); public synchronized void addKeyListener (KeyListener l); public synchronized void addMouseListener (MouseListener l); public synchronized void addMouseMotionListener (MouseMotionListener l); public void addNotify();
public Rectangle bounds(); (Deprecated) public int checkImage (Image image, ImageObserver observer);
public int checkImage (Image image, int width, int height, ImageObserver observer);
public boolean contains (int x, int y); public boolean contains (Point p); public Image createImage (ImageProducer producer);
public Image createImage (int width, int height);
public void deliverEvent (Event e); (Deprecated) public void disable(); (Deprecated) public final void dispatchEvent (AWTEvent e) public void doLayout(); public void enable(); (Deprecated) public void enable (boolean condition); (Deprecated) public float getAlignmentX(); public float getAlignmentY(); public Color getBackground();
public Rectangle getBounds(); public synchronized ColorModel getColorModel();
public Component getComponentAt (int x, int y); public Component getComponentAt (Point p); public Cursor getCursor(); public Font getFont();
public FontMetrics getFontMetrics (Font f);
public Color getForeground();
public Graphics getGraphics();
public Locale getLocale(); public Point getLocation(); public Point getLocationOnScreen(); public Dimension getMaximumSize(); public Dimension getMinimumSize(); public String getName(); public Container getParent();
public ComponentPeer getPeer(); (Deprecated) public Dimension getPreferredSize(); public Dimension getSize(); public Toolkit getToolkit();
public final Object getTreeLock(); public boolean gotFocus (Event e, Object o); (Deprecated) public boolean handleEvent (Event e); (Deprecated) public void hide(); (Deprecated) public boolean imageUpdate (Image image, int infoflags, int x, int y, int width, int height);
public boolean inside (int x, int y); (Deprecated) public void invalidate();
public boolean isEnabled();
public boolean isFocusTraversable(); public boolean isShowing();
public boolean isValid();
public boolean isVisible();
public boolean keyDown (Event e, int key); (Deprecated) public boolean keyUp (Event e, int key); (Deprecated) public void layout(); (Deprecated) public void list();
public void list (PrintStream out);
public void list (PrintStream out, int indentation);
public void list (PrintWriter out); public void list (PrintWriter out, int indentation); public Component locate (int x, int y); (Deprecated) public Point location(); (Deprecated) public boolean lostFocus (Event e, Object o); (Deprecated) public Dimension minimumSize(); (Deprecated) public boolean mouseDown (Event e, int x, int y); (Deprecated) public boolean mouseDrag (Event e, int x, int y); (Deprecated) public boolean mouseEnter (Event e, int x, int y); (Deprecated) public boolean mouseExit (Event e, int x, int y); (Deprecated) public boolean mouseMove (Event e, int x, int y); (Deprecated) public boolean mouseUp (Event e, int x, int y); (Deprecated) public void move (int x, int y); (Deprecated) public void nextFocus(); (Deprecated) public void paint (Graphics g);
public void paintAll (Graphics g);
public boolean postEvent (Event e); (Deprecated) public Dimension preferredSize(); (Deprecated) public boolean prepareImage (Image image, ImageObserver observer);
public boolean prepareImage (Image image, int width, int height, ImageObserver observer);
public void print (Graphics g);
public void printAll (Graphics g);
public synchronized void remove (MenuComponent popup); public synchronized void removeComponentListener (ComponentListener l); public synchronized void removeFocusListener (FocusListener l); public synchronized void removeKeyListener (KeyListener l); public synchronized void removeMouseListener (MouseListener l); public synchronized void removeMouseMotionListener (MouseMotionListener l); public void removeNotify();
public void repaint();
public void repaint (long tm);
public void repaint (int x, int y, int width, int height);
public void repaint (long tm, int x, int y, int width, int height);
public void requestFocus();
public void reshape (int x, int y, int width, int height); (Deprecated) public void resize (Dimension d); (Deprecated) public void resize (int width, int height); (Deprecated) public void setBackground (Color c);
public void setBounds (int x, int y, int width, int height); public void setBounds (Rectangle r); public synchronized void setCursor (Cursor cursor); public void setEnabled (boolean b); public synchronized void setFont (Font f);
public void setForeground (Color c);
public void setLocale (Locale l); public void setLocation (int x, int y); public void setLocation (Point p); public void setName (String name); public void setSize (int width, int height); public void setSize (Dimension d); public void setVisible (boolean b); public void show(); (Deprecated) public void show (boolean condition); (Deprecated) public Dimension size(); (Deprecated) public String toString();
public void transferFocus(); public void update (Graphics g);
public void validate(); // Protected Instance Methods protected final void disableEvents (long eventsToDisable); protected final void enableEvents (long eventsToEnable); protected String paramString(); protected void processComponentEvent (ComponentEvent e); protected void processEvent (AWTEvent e); protected void processFocusEvent (FocusEvent e); protected void processKeyEvent (KeyEvent e); protected void processMouseEvent (MouseEvent e); protected void processMouseMotionEvent (MouseEvent e);
}

Constants

BOTTOM_ALIGNMENT

public final static float BOTTOM_ALIGNMENT

Constant representing bottom alignment in getAlignmentY().

CENTER_ALIGNMENT

public final static float CENTER_ALIGNMENT

Constant representing center alignment in getAlignmentX() and getAlignmentY().

LEFT_ALIGNMENT

public final static float LEFT_ALIGNMENT

Constant representing left alignment in getAlignmentX().

RIGHT_ALIGNMENT

public final static float RIGHT_ALIGNMENT

Constant representing right alignment in getAlignmentX().

TOP_ALIGNMENT

public final static float TOP_ALIGNMENT

Constant representing top alignment in getAlignmentY().

Variables

locale

protected Locale locale

Constructors

Component

protected Component()

Instance Methods

action

public boolean action (Event e, Object o) (Deprecated)

add

public synchronized void add (PopupMenu popup)

addComponentListener

public void addComponentListener (ComponentListener l)

addFocusListener

public void addFocusListener (FocusListener l)

addKeyListener

public void addKeyListener (KeyListener l)

addMouseListener

public void addMouseListener (MouseListener l)

addMouseMotionListener

public void addMouseMotionListener (MouseMotionListener l)

addNotify

public void addNotify()

bounds

public Rectangle bounds() (Deprecated)

checkImage

public int checkImage (Image image, ImageObserver observer)

public int checkImage (Image image, int width, int height, ImageObserver observer)

contains

public boolean contains (int x, int y)

public boolean contains (Point p)

createImage

public Image createImage (ImageProducer producer)

public Image createImage (int width, int height)

deliverEvent

public void deliverEvent (Event e) (Deprecated)

disable

public void disable() (Deprecated)

dispatchEvent

public final void dispatchEvent (AWTEvent e)

doLayout

public void doLayout()

enable

public void enable() (Deprecated)

public void enable (boolean condition) (Deprecated)

getAlignmentX

public float getAlignmentX()

getAlignmentY

public float getAlignmentY()

getBackground

public Color getBackground()

getBounds

public Rectangle getBounds()

getColorModel

public synchronized ColorModel getColorModel()

getComponentAt

public Component getComponentAt (int x, int y)

public Component getComponentAt (Point p)

getCursor

public Cursor getCursor()

getFont

public Font getFont()

getFontMetrics

public FontMetrics getFontMetrics (Font f)

getForeground

public Color getForeground()

getGraphics

public Graphics getGraphics()

getLocale

public Locale getLocale()

getLocation

public Point getLocation()

getLocationOnScreen

public Point getLocationOnScreen()

getMaximumSize

public Dimension getMaximumSize()

getMinimumSize

public Dimension getMinimumSize()

getName

public String getName()

getParent

public Container getParent()

getPeer

public ComponentPeer getPeer() (Deprecated)

getPreferredSize

public Dimension getPreferredSize()

getSize

public Dimension getSize()

getToolkit

public Toolkit getToolkit()

getTreeLock

public final Object getTreeLock()

gotFocus

public boolean gotFocus (Event e, Object o) (Deprecated)

handleEvent

public boolean handleEvent (Event e) (Deprecated)

hide

public void hide() (Deprecated)

imageUpdate

public boolean imageUpdate (Image image, int infoflags, int x, int y, int width, int height)

inside

public boolean inside (int x, int y) (Deprecated)

invalidate

public void invalidate()

isEnabled

public boolean isEnabled()

isFocusTraversable

public boolean isFocusTraversable()

isShowing

public boolean isShowing()

isValid

public boolean isValid()

isVisible

public boolean isVisible()

keyDown

public boolean keyDown (Event e, int key) (Deprecated)

keyUp

public boolean keyUp (Event e, int key) (Deprecated)

layout

public void layout() (Deprecated)

list

public void list()

public void list (PrintStream out)

public void list (PrintStream out, int indentation)

public void list (PrintWriter out)

public void list (PrintWriter out, int indentation)

locate

public Component locate (int x, int y) (Deprecated)

location

public Point location() (Deprecated)

lostFocus

public boolean lostFocus (Event e, Object o) (Deprecated)

minimizeSize

public Dimension minimumSize() (Deprecated)

mouseDown

public boolean mouseDown (Event e, int x, int y) (Deprecated)

mouseDrag

public boolean mouseDrag (Event e, int x, int y) (Deprecated)

mouseEnter

public boolean mouseEnter (Event e, int x, int y) (Deprecated)

mouseExit

public boolean mouseExit (Event e, int x, int y) (Deprecated)

mouseMove

public boolean mouseMove (Event e, int x, int y) (Deprecated)

mouseUp

public boolean mouseUp (Event e, int x, int y) (Deprecated)

move

public void move (int x, int y) (Deprecated)

nextFocus

public void nextFocus() (Deprecated)

paint

public void paint (Graphics g)

paintAll

public void paintAll (Graphics g)

postEvent

public boolean postEvent (Event e) (Deprecated)

preferredSize

public Dimension preferredSize() (Deprecated)

prepareImage

public boolean prepareImage (Image image, ImageObserver observer)

public boolean prepareImage (Image image, int width, int height, ImageObserver observer)

print

public void print (Graphics g)

printAll

public void printAll (Graphics g)

remove

public void remove (MenuComponent popup)

removeComponentListener

public void removeComponentListener (ComponentListener l)

removeFocusListener

public void removeFocusListener (FocusListener l)

removeKeyListener

public void removeKeyListener (KeyListener l)

removeMouseListener

public void removeMouseListener (MouseListener l)

removeMouseMotionListener

public void removeMouseMotionListener (MouseMotionListener l)

removeNotify

public void removeNotify()

repaint

public void repaint()

public void repaint (long tm)

public void repaint (int x, int y, int width, int height)

public void repaint (long tm, int x, int y, int width, int height)

requestFocus

public void requestFocus()

reshape

public void reshape (int x, int y, int width, int height) (Deprecated)

resize

public void resize (Dimension d) (Deprecated)

public void resize (int width, int height) (Deprecated)

setBackground

public void setBackground (Color c)

setBounds

public void setBounds (int x, int y, int width, int height)

public void setBounds (Rectangle r)

setCursor

public synchronized void setCursor (Cursor cursor)

setEnabled

public void setEnabled (boolean b)

setFont

public synchronized void setFont (Font f)

setForeground

public void setForeground (Color c)

setLocale

public void setLocale (Locale l)

setLocation

public void setLocation (int x, int y)

public void setLocation (Point p)

setName

public void setName (String name)

setSize

public void setSize (int width, int height)

public void setSize (Dimension d)

setVisible

public void setVisible (boolean b)

show

public void show() (Deprecated)

public void show (boolean condition) (Deprecated)

size

public Dimension size() (Deprecated)

toString

public String toString()

transferFocus

public void transferFocus()

update

public void update (Graphics g)

validate

public void validate()

Protected Instance Methods

disableEvents

protected final void disableEvents (long eventsToDisable)

enableEvents

protected final void enableEvents (long eventsToEnable)

paramString

protected String paramString()

processComponentEvent

protected void processComponentEvent(ComponentEvent e)

processEvent

protected void processEvent(AWTEvent e)

processFocusEvent

protected void processFocusEvent(FocusEvent e)

processKeyEvent

protected void processKeyEvent(KeyEvent e)

processMouseEvent

protected void processMouseEvent(MouseEvent e)

processMouseMotionEvent

protected void processMouseMotionEvent(MouseEvent e)

See Also

Button, Canvas, Checkbox, Choice, Color, ColorModel, ComponentPeer, Container, Dimension, Event, Font, FontMetrics, Graphics, ImageObserver, ImageProducer, Label, List, MenuContainer, Object, Point, PrintStream, Rectangle, Scrollbar, Serializable, String, TextComponent, Toolkit