The Component class is the parent of all non-menu GUI components.
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); 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(); 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); public void disable(); public final void dispatchEvent (AWTEvent e) public void doLayout(); public void enable(); public void enable (boolean condition); 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(); public Dimension getPreferredSize(); public Dimension getSize(); public Toolkit getToolkit(); public final Object getTreeLock(); public boolean gotFocus (Event e, Object o); public boolean handleEvent (Event e); public void hide(); public boolean imageUpdate (Image image, int infoflags, int x, int y, int width, int height); public boolean inside (int x, int y); 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); public boolean keyUp (Event e, int key); public void layout(); 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); public Point location(); public boolean lostFocus (Event e, Object o); public Dimension minimumSize(); public boolean mouseDown (Event e, int x, int y); public boolean mouseDrag (Event e, int x, int y); public boolean mouseEnter (Event e, int x, int y); public boolean mouseExit (Event e, int x, int y); public boolean mouseMove (Event e, int x, int y); public boolean mouseUp (Event e, int x, int y); public void move (int x, int y); public void nextFocus(); public void paint (Graphics g); public void paintAll (Graphics g); public boolean postEvent (Event e); public Dimension preferredSize(); 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); public void resize (Dimension d); public void resize (int width, int height); 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(); public void show (boolean condition); public Dimension size(); 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); }
Constant representing bottom alignment in getAlignmentY().
Constant representing center alignment in getAlignmentX() and getAlignmentY().
Constant representing left alignment in getAlignmentX().
Constant representing right alignment in getAlignmentX().
Constant representing top alignment in getAlignmentY().
The locale for the component. Used for internationalization support.
This constructor creates a "lightweight" component. This constructor allows Component to be directly subclassed using code written entirely in Java.
Event instance identifying what triggered the call to this method.
Argument specific to the component subclass that generated the event.
true if event handled, false to propagate it to parent container.
Method called when user performs some action in Component. This method is a relic of the old 1.0.2 event model and is replaced by the process...Event() methods.
The menu to add.
After the PopupMenu is added to a component, it can be shown in the component's coordinate space.
Adds a listener for the ComponentEvent objects this Component generates.
Adds a listener for the FocusEvent objects this Component generates.
Adds a listener for the KeyEvent objects this Component generates.
Adds a listener for the MouseEvent objects this Component generates.
Adds a listener for the motion MouseEvent objects this Component generates.
Creates peer of Component's subclass.
Gets bounding rectangle of Component.
A Rectangle that returns the outer limits of the Component. Replaced by getBounds() in 1.1.
Image to check.
The object an image will be rendered onto.
ImageObserver Flags ORed together indicating the image's status.
Checks status of image construction.
Image to check.
Horizontal size image will be scaled to.
Vertical size image will be scaled to.
Object image will be rendered onto.
ImageObserver flags ORed together indicating the image's status.
Checks status of image construction.
The x coordinate, in this Component's coordinate system.
The y coordinate, in this Component's coordinate system.
true if the Component contains the point; false otherwise.
The point to be tested, in this Component's coordinate system.
true if the Component contains the point; false otherwise.
Class that implements ImageProducer interface to create the new image.
Newly created image instance.
Creates an Image based upon an ImageProducer.
Horizontal size for in-memory Image.
Vertical size for in-memory Image.
Newly created image instance.
Creates an empty in-memory Image for double buffering; to draw on the image, use its graphics context.
Event instance to deliver.
Delivers event to the component for processing.
Disables component so that it is unresponsive to user interactions. Replaced by setEnabled(false).
The AWTEvent to process.
Tells the component to deal with the AWTEvent e.
Lays out component. This method is a replacement for layout().
Enables component so that it is responsive to user interactions. Use setEnabled(true) instead.
true to enable the component; false to disable it.
Enables or disables the component based upon condition. Use setEnabled(boolean) instead.
A number between 0 and 1 representing the horizontal alignment of this component.
One of the constants LEFT_ALIGNMENT, CENTER_ALIGNMENT, or RIGHT_ALIGNMENT may be returned. CENTER_ALIGNMENT is returned by default.
A number between 0 and 1 representing the vertical alignment of this component.
One of the constants TOP_ALIGNMENT, CENTER_ALIGNMENT, or BOTTOM_ALIGNMENT may be returned. CENTER_ALIGNMENT is returned by default.
Background color of the component.
Gets bounding rectangle of Component.
Returns a Rectangle that returns the outer limits of the Component.
ColorModel used to display the current component.
The x coordinate, in this Component's coordinate system.
The y coordinate, in this Component's coordinate system.
Returns the Component containing the given point.
The point to be tested, in this Component's coordinate system.
Returns the Component containing the given point.
Current cursor of the component.
Current font of the component.
A Font object, whose platform specific information is desired.
Size information for the given Font.
Foreground color of component.
If acquiring graphics context is unsupported.
Component's graphics context.
If the component does not have a locale or it has not been added to a hierarchy that does.
Component's locale.
Position of component.
Gets the current position of this Component in its parent's coordinate space.
Position of component.
Gets the current position of this Component in the screen's coordinate space.
The maximum dimensions of the component.
By default, a maximal Dimension is returned.
The minimum dimensions of the component.
This component's name.
Parent Container of Component.
Gets container that this Component is held in.
Peer of Component.
The preferred dimensions of the component.
Dimensions of component.
Gets width and height of component.
Toolkit of Component.
The AWT tree locking object.
Returns the object used for tree locking and layout operations.
Event instance identifying what triggered the call to this method.
Argument specific to the component subclass that generated the event.
true if event handled, false to propagate it to parent container.
Called when Component gets input focus. This method is not used in the 1.1 event model.
Event instance identifying what triggered the call to this method.
true if event handled, false to propagate it to parent container.
High-level event handling routine that calls helper routines. Replaced by processEvent(AWTEvent).
Hides component from view. Replaced by setVisible(false).
Image being loaded.
ImageObserver flags ORed together of available information.
x coordinate of upper-left corner of Image.
y coordinate of upper-left corner of Image.
Horizontal dimension of Image.
Vertical dimension of Image.
true if Image fully loaded, false otherwise.
ImageObserver.imageUpdate()
An asynchronous update interface for receiving notifications about Image information as it is loaded. Meaning of parameters changes with values of flags.
Horizontal position.
Vertical position.
true if the point (x, y) falls within the component's bounds, false otherwise.
Checks if coordinates are within bounding box of Component. Replaced by contains(int, int).
Sets the component's valid state to false.
true if enabled, false otherwise.
Checks to see if the Component is currently enabled.
true if this Component can be traversed using Tab and Shift-Tab, false otherwise.
Checks to see if the Component is navigable using the keyboard.
true if showing, false otherwise.
Checks to see if the Component is currently showing.
true if valid, false otherwise.
Checks to see if the Component is currently valid.
true if visible, false otherwise.
Checks to see if the Component is currently visible.
Event instance identifying what triggered the call to this method.
Integer representation of key pressed.
true if event handled, false to propagate it to parent container.
Method called whenever the user presses a key. Replaced by processKeyEvent(KeyEvent).
Event instance identifying what triggered the call to this method.
Integer representation of key released.
true if event handled, false to propagate it to parent container.
Method called whenever the user releases a key. Replaced by processKeyEvent(KeyEvent).
Lays out component. Replaced by doLayout().
Prints the contents of the Component to System.out.
Output stream to send results to.
Prints the contents of the Component to a PrintStream.
Output stream to send results to.
Indentation to use when printing.
Prints the contents of the Component indented to a PrintStream.
Output stream to send results to.
Prints the contents of the Component to a PrintWriter.
Output stream to send results to.
Indentation to use when printing.
Prints the contents of the Component indented to a PrintWriter.
Horizontal position.
Vertical position.
Component if the point (x, y) falls within the component, null otherwise.
Replaced by getComponentAt(int, int).
Position of component.
Gets the current position of this Component in its parent's coordinate space. Replaced by getLocation().
Event instance identifying what triggered the call to this method.
Argument specific to the component subclass that generated the event.
true if event handled, false to propagate it to parent container.
Method called when Component loses input focus. Replaced by processFocusEvent(FocusEvent).
The minimum dimensions of the component. Replaced by getMinimumSize().
Event instance identifying what triggered the call to this method.
Horizontal position of the mouse within Component when Event initiated
Vertical position of the mouse within Component when Event initiated
true if event handled, false to propagate it to parent container.
Method called when the user presses a mouse button over Component. Replaced by processMouseEvent(MouseEvent).
Event instance identifying what triggered the call to this method.
Horizontal position of the mouse within Component when Event initiated
Vertical position of the mouse within Component when Event initiated
true if event handled, false to propagate it to parent container.
Method called when the user is pressing a mouse button and moves the mouse. Replaced by processMouseMotionEvent(MouseEvent).
Event instance identifying what triggered the call to this method.
Horizontal position of the mouse within Component when Event initiated
Vertical position of the mouse within Component when Event initiated
true if event handled, false to propagate it to parent container.
Method called when the mouse enters Component. Replaced by processMouseEvent(MouseEvent).
Event instance identifying what triggered the call to this method.
Horizontal position of the mouse within Component when Event initiated
Vertical position of the mouse within Component when Event initiated
true if event handled, false to propagate it to parent container.
Method called when the mouse exits Component. Replaced by processMouseEvent(MouseEvent).
Event instance identifying what triggered the call to this method.
Horizontal position of the mouse within Component when Event initiated
Vertical position of the mouse within Component when Event initiated
true if event handled, false to propagate it to parent container.
Method called when the user is not pressing a mouse button and moves the mouse. Replaced by processMouseMotionEvent(MouseEvent).
Event instance identifying what triggered the call to this method.
Horizontal position of the mouse within Component when Event initiated
Vertical position of the mouse within Component when Event initiated
true if event is handled, false to propagate it to the parent container.
Method called when user releases mouse button over Component. Replaced by processMouseEvent(MouseEvent).
New horizontal position for component.
New vertical position for component.
Relocates component. Replaced by setLocation(int, int).
Moves focus from current component to next one in parent container. Replaced by transferFocus().
Graphics context of component.
Empty method to be overridden to draw something in the graphics context.
Graphics context of component.
Method to validate component and paint its peer if it is visible.
Event instance to post to component
If Event is handled, true is returned. Otherwise, false is returned.
Tells Component to deal with Event.
The preferred dimensions of the component. Replaced by getPreferredSize().
Image to start loading.
Component on which image will be rendered.
true if Image is fully loaded, false otherwise.
Forces Image to start loading.
Image to start loading.
Horizontal size of the Image after scaling.
Vertical size of the Image after scaling.
Component on which image will be rendered.
true if Image is fully loaded, false otherwise.
Forces Image to start loading.
Graphics context.
Empty method to be overridden to print something into the graphics context.
Graphics context.
Method to print this component and its children.
The menu to remove.
After adding a PopupMenu, you can use this method to remove it.
Removes the specified ComponentListener from this Component.
Removes the specified FocusListener from this Component.
Removes the specified KeyListener from this Component.
Removes the specified MouseListener from this Component.
Removes the specified MouseMotionListener from this Component.
Removes peer of Component's subclass.
Requests scheduler to redraw the component as soon as possible.
Millisecond delay allowed before repaint.
Requests scheduler to redraw the component within a time period.
Horizontal origin of bounding box to redraw.
Vertical origin of bounding box to redraw.
Width of bounding box to redraw.
Height of bounding box to redraw.
Requests scheduler to redraw a portion of component as soon as possible.
Millisecond delay allowed before repaint.
Horizontal origin of bounding box to redraw.
Vertical origin of bounding box to redraw.
Width of bounding box to redraw.
Height of bounding box to redraw.
Requests scheduler to redraw a portion of component within a time period.
Requests the input focus for this Component.
New horizontal position for component.
New vertical position for component.
New width for component.
New height for component.
Relocates and resizes component. Replaced by setBounds(int, int, int, int).
New dimensions for the component.
Resizes component. Replaced by setSize(Dimension).
New width for component.
New height for component.
Resizes component. Replaced by setSize(int, int).
New background color.
Changes the component's background color.
New horizontal position for component.
New vertical position for component.
New width for component.
New height for component.
Relocates and resizes the component.
New coordinates for component.
Relocates and resizes component.
The new cursor for the component.
Changes the component's cursor.
true to enable the component, false to disable it.
Enables or disables the component. Replaces enable(), enable(boolean), and disable().
Font to change component to.
Changes the font of the component.
New foreground color.
Changes the foreground color of component's area.
The locale object for the component.
Sets the Component's locale.
New horizontal position for component.
New vertical position for component.
Relocates the component.
New position for component.
Relocates the component.
New name for component.
Sets the component's name.
New width for component.
New height for component.
Resizes the component.
New dimensions for the component.
Resizes the component.
true to show component, false to hide it.
Shows or hides the component based on the b parameter.
Replaced by setVisible(true).
true to show the component, false to hide it.
Replaced by setVisible(boolean).
Dimensions of the component.
Gets width and height of the component. Replaced by getSize().
A string representation of the Component object.
Object.toString()
Transfers focus to the next component in the container hierarchy.
Graphics context of component.
Called to update the component's display area.
Sets the component's valid state to true.
A value representing certain kinds of events. This can be constructed by ORing the event mask constants defined in java.awt.AWTEvent.
By default, a component receives events corresponding to the event listeners that have registered. If a component should not receive events of a certain type, even if there is a listener registered for that type of event, this method can be used to disable that event type.
A value representing certain kinds of events. This can be constructed by ORing the event mask constants defined in java.awt.AWTEvent.
By default, a component receives events corresponding to the event listeners that have registered. If a component should receive other types of events as well, this method can be used to request them.
A String with the current settings of the Component.
Helper method for toString() to generate a string of current settings.
The event to process.
Component events are passed to this method for processing. Normally, this method is called by processEvent().
The event to process.
Low level AWTEvents are passed to this method for processing.
The event to process.
Focus events are passed to this method for processing. Normally, this method is called by processEvent().
The event to process.
Key events are passed to this method for processing. Normally, this method is called by processEvent().
The event to process.
Mouse events are passed to this method for processing. Normally, this method is called by processEvent().
The event to process.
Mouse motion events are passed to this method for processing. Normally, this method is called by processEvent().
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
This HTML Help has been published using the chm2web software. |