java.awt
Class Component

java.lang.Object
  |
  +--java.awt.Component
All Implemented Interfaces:
java.awt.image.ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
Button, Canvas, Checkbox, Choice, Container, Label, List, javax.swing.SystemEventQueueUtilities.RunnableTarget, SacrificialComponent, Scrollbar, TextComponent

public abstract class Component
extends Object
implements java.awt.image.ImageObserver, MenuContainer, Serializable

Safe:

See Also:
Serialized Form

Field Summary
(package private)  AccessibleContext accessibleContext
           
(package private) static String actionListenerK
          Internal, constants for serialization
(package private) static String adjustmentListenerK
           
(package private)  sun.awt.AppContext appContext
          The AppContext of the component.
(package private)  Color background
          The background color for this component.
static float BOTTOM_ALIGNMENT
          Enabled: Ease-of-use constant for getAlignmentY.
(package private)  java.awt.image.BufferStrategy bufferStrategy
          A reference to a BufferStrategy object used to manipulate the buffers on this component.
static float CENTER_ALIGNMENT
          Enabled: Ease-of-use constant for getAlignmentY and getAlignmentX.
private  java.beans.PropertyChangeSupport changeSupport
          If any PropertyChangeListeners have been registered, the changeSupport field describes them.
(package private)  ComponentListener componentListener
           
(package private) static String componentListenerK
           
(package private)  ComponentOrientation componentOrientation
          The orientation for this component.
private  int componentSerializedDataVersion
          Component Serialized Data Version.
(package private) static String containerListenerK
           
(package private)  Cursor cursor
          The cursor displayed when pointer is over this component.
private static sun.awt.DebugHelper dbg
           
(package private)  DropTarget dropTarget
          The DropTarget associated with this component.
(package private)  boolean enabled
          True when the object is enabled.
(package private)  long eventMask
          The eventMask is ONLY set by subclasses via enableEvents.
private static int FOCUS_TRAVERSABLE_DEFAULT
           
private static int FOCUS_TRAVERSABLE_SET
           
private static int FOCUS_TRAVERSABLE_UNKNOWN
           
private  boolean focusable
          Indicates whether this Component can be focused.
(package private)  FocusListener focusListener
           
(package private) static String focusListenerK
           
private static String[] focusTraversalKeyPropertyNames
           
(package private)  Set[] focusTraversalKeys
          The focus traversal keys.
private  boolean focusTraversalKeysEnabled
          Indicates whether focus traversal keys are enabled for this Component.
(package private)  Font font
          The font used by this component.
(package private)  Color foreground
          The foreground color for this component.
(package private)  GraphicsConfiguration graphicsConfig
          A reference to a GraphicsConfiguration object used to describe the characteristics of a graphics destination.
(package private)  int height
          The height of the component.
(package private)  HierarchyBoundsListener hierarchyBoundsListener
           
(package private) static String hierarchyBoundsListenerK
           
(package private)  HierarchyListener hierarchyListener
           
(package private) static String hierarchyListenerK
           
(package private)  boolean ignoreRepaint
          True when the object should ignore all repaint events.
(package private) static int incRate
           
(package private)  InputMethodListener inputMethodListener
           
(package private) static String inputMethodListenerK
           
private  int isFocusTraversableOverridden
          Tracks whether this Component is relying on default focus travesability.
(package private) static boolean isInc
          Static properties for incremental drawing.
(package private)  boolean isPacked
           
(package private) static String itemListenerK
           
(package private)  KeyListener keyListener
           
(package private) static String keyListenerK
           
static float LEFT_ALIGNMENT
          Enabled: Ease-of-use constant for getAlignmentX.
(package private)  Locale locale
          The locale for the component.
(package private) static Object LOCK
          The locking object for AWT component-tree and layout operations.
(package private) static Hashtable metrics
          saves an internal cache of FontMetrics for better performance
(package private)  Dimension minSize
          Internal, cached size information.
(package private)  MouseListener mouseListener
           
(package private) static String mouseListenerK
           
(package private)  MouseMotionListener mouseMotionListener
           
(package private) static String mouseMotionListenerK
           
(package private)  MouseWheelListener mouseWheelListener
           
(package private) static String mouseWheelListenerK
           
private  String name
          A component's name.
private  boolean nameExplicitlySet
          A bool to determine whether the name has been set explicitly.
(package private)  boolean newEventsOnly
          newEventsOnly will be true if the event is one of the event types enabled for the component.
(package private) static String ownedWindowK
           
(package private)  Container parent
          The parent of the object.
(package private)  java.awt.peer.ComponentPeer peer
          The peer of the component.
(package private)  Font peerFont
          The font which the peer is currently using.
(package private)  Vector popups
           
(package private)  Dimension prefSize
          Internal, cached size information (This field perhaps should have been transient).
private  Object privateKey
          This object is used as a key for internal hashtables.
static float RIGHT_ALIGNMENT
          Enabled: Ease-of-use constant for getAlignmentX.
private static long serialVersionUID
           
(package private) static String textListenerK
           
static float TOP_ALIGNMENT
          Enabled: Ease-of-use constant for getAlignmentY().
(package private)  boolean valid
          True when the object is valid.
(package private)  boolean visible
          True when the object is visible.
(package private)  int width
          The width of the component.
(package private)  RuntimeException windowClosingException
           
(package private) static String windowFocusListenerK
           
(package private) static String windowListenerK
           
(package private) static String windowStateListenerK
           
(package private)  int x
          The x position of the component in the parent's coordinate system.
(package private)  int y
          The y position of the component in the parent's coordinate system.
 
Constructor Summary
protected Component()
          Constructs a new component.
 
Method Summary
 boolean action(Event evt, Object what)
          Suppressed: @deprecated As of JDK version 1.1, should register this component as ActionListener on component which fires action events.
 void add(PopupMenu popup)
          Enabled: Adds the specified popup menu to the component.
 void addComponentListener(ComponentListener l)
          Enabled: Adds the specified component listener to receive component events from this component.
 void addFocusListener(FocusListener l)
          Suppressed: Adds the specified focus listener to receive focus events from this component when this component gains input focus.
 void addHierarchyBoundsListener(HierarchyBoundsListener l)
          Suppressed: Adds the specified hierarchy bounds listener to receive hierarchy bounds events from this component when the hierarchy to which this container belongs changes.
 void addHierarchyListener(HierarchyListener l)
          Suppressed: Adds the specified hierarchy listener to receive hierarchy changed events from this component when the hierarchy to which this container belongs changes.
 void addInputMethodListener(InputMethodListener l)
          Suppressed: Adds the specified input method listener to receive input method events from this component.
 void addKeyListener(KeyListener l)
          Enabled: Adds the specified key listener to receive key events from this component.
 void addMouseListener(MouseListener l)
          Enabled: Adds the specified mouse listener to receive mouse events from this component.
 void addMouseMotionListener(MouseMotionListener l)
          Enabled: Adds the specified mouse motion listener to receive mouse motion events from this component.
 void addMouseWheelListener(MouseWheelListener l)
          Enabled: Adds the specified mouse wheel listener to receive mouse wheel events from this component.
 void addNotify()
          Suppressed: Makes this Component displayable by connecting it to a native screen resource.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Suppressed: Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(String propertyName, java.beans.PropertyChangeListener listener)
          Suppressed: Adds a PropertyChangeListener to the listener list for a specific property.
(package private)  void adjustListeningChildrenOnParent(long mask, int num)
           
 void applyComponentOrientation(ComponentOrientation orientation)
          Suppressed: Sets the ComponentOrientation property of this component and all components contained within it.
 boolean areFocusTraversalKeysSet(int id)
          Suppressed: Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Component.
(package private)  boolean areInputMethodsEnabled()
           
(package private)  void autoProcessMouseWheel(MouseWheelEvent e)
           
(package private)  void autoTransferFocus(boolean clearOnFailure)
           
 Rectangle bounds()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getBounds().
(package private)  void checkGD(String stringID)
          Checks that this component's GraphicsDevice idString matches the string argument.
 int checkImage(Image image, java.awt.image.ImageObserver observer)
          Suppressed: Returns the status of the construction of a screen representation of the specified image.
 int checkImage(Image image, int width, int height, java.awt.image.ImageObserver observer)
          Suppressed: Returns the status of the construction of a screen representation of the specified image.
(package private)  boolean checkWindowClosingException()
           
(package private)  void clearCurrentFocusCycleRootOnHide()
           
(package private)  void clearMostRecentFocusOwnerOnHide()
           
protected  AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent)
          Potentially coalesce an event being posted with an existing event.
(package private)  String constructComponentName()
          Constructs a name for this component.
 boolean contains(int x, int y)
          Enabled: Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component.
 boolean contains(Point p)
          Suppressed: Checks whether this component "contains" the specified point, where the point's x and y coordinates are defined to be relative to the coordinate system of this component.
(package private)  boolean containsFocus()
           
(package private)  int countHierarchyMembers()
           
(package private)  void createBufferStrategy(int numBuffers)
          Creates a new strategy for multi-buffering on this component.
(package private)  void createBufferStrategy(int numBuffers, BufferCapabilities caps)
          Creates a new strategy for multi-buffering on this component with the required buffer capabilities.
(package private)  void createChildHierarchyEvents(int id, long changeFlags, boolean enabledOnToolkit)
           
(package private)  int createHierarchyEvents(int id, Component changed, Container changedParent, long changeFlags, boolean enabledOnToolkit)
           
 Image createImage(java.awt.image.ImageProducer producer)
          Enabled: Creates an image from the specified image producer.
 Image createImage(int width, int height)
          Enabled: Creates an off-screen drawable image to be used for double buffering.
 java.awt.image.VolatileImage createVolatileImage(int width, int height)
          Suppressed: Creates a volatile off-screen drawable image to be used for double buffering.
 java.awt.image.VolatileImage createVolatileImage(int width, int height, ImageCapabilities caps)
          Suppressed: Creates a volatile off-screen drawable image, with the given capabilities.
 void deliverEvent(Event e)
          Suppressed: @deprecated As of JDK version 1.1, replaced by dispatchEvent(AWTEvent e).
 void disable()
          Suppressed: @deprecated As of JDK version 1.1, replaced by setEnabled(boolean).
protected  void disableEvents(long eventsToDisable)
          Disables the events defined by the specified event mask parameter from being delivered to this component.
 void dispatchEvent(AWTEvent e)
          Suppressed: Dispatches an event to this component or one of its sub components.
(package private)  void dispatchEventImpl(AWTEvent e)
           
(package private)  boolean dispatchMouseWheelToAncestor(MouseWheelEvent e)
           
private  void doAutoTransfer(boolean clearOnFailure)
           
 void doLayout()
          Suppressed: Prompts the layout manager to lay out this component.
 void enable()
          Suppressed: @deprecated As of JDK version 1.1, replaced by setEnabled(boolean).
 void enable(boolean b)
          Suppressed: @deprecated As of JDK version 1.1, replaced by setEnabled(boolean).
protected  void enableEvents(long eventsToEnable)
          Enables the events defined by the specified event mask parameter to be delivered to this component.
 void enableInputMethods(boolean enable)
          Suppressed: Enables or disables input method support for this component.
(package private)  boolean eventEnabled(AWTEvent e)
           
(package private)  boolean eventTypeEnabled(int type)
           
protected  void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
          Support for reporting bound property changes for boolean properties.
protected  void firePropertyChange(String propertyName, int oldValue, int newValue)
          Support for reporting bound property changes for integer properties.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Support for reporting bound property changes for Object properties.
 AccessibleContext getAccessibleContext()
          Suppressed: Gets the AccessibleContext associated with this Component.
(package private)  int getAccessibleIndexInParent()
          Gets the index of this object in its accessible parent.
(package private)  AccessibleStateSet getAccessibleStateSet()
          Gets the current state set of this object.
 float getAlignmentX()
          Enabled: Returns the alignment along the x axis.
 float getAlignmentY()
          Enabled: Returns the alignment along the y axis.
(package private)  Image getBackBuffer()
           
 Color getBackground()
          Enabled: Gets the background color of this component.
 Rectangle getBounds()
          Enabled: Gets the bounds of this component in the form of a Rectangle object.
 Rectangle getBounds(Rectangle rv)
          Suppressed: Stores the bounds of this component into "return value" rv and return rv.
(package private)  java.awt.image.BufferStrategy getBufferStrategy()
           
 java.awt.image.ColorModel getColorModel()
          Suppressed: Gets the instance of ColorModel used to display the component on the output device.
 Component getComponentAt(int x, int y)
          Enabled: Determines if this component or one of its immediate subcomponents contains the (xy) location, and if so, returns the containing component.
 Component getComponentAt(Point p)
          Suppressed: Returns the component or subcomponent that contains the specified point.
 ComponentListener[] getComponentListeners()
          Suppressed: Returns an array of all the component listeners registered on this component.
 ComponentOrientation getComponentOrientation()
          Suppressed: Retrieves the language-sensitive orientation that is to be used to order the elements or text within this component.
 Cursor getCursor()
          Enabled: Gets the cursor set in the component.
 DropTarget getDropTarget()
          Enabled: Gets the DropTarget associated with this Component.
 Container getFocusCycleRootAncestor()
          Suppressed: Returns the Container which is the focus cycle root of this Component's focus traversal cycle.
 FocusListener[] getFocusListeners()
          Suppressed: Returns an array of all the focus listeners registered on this component.
(package private)  Set getFocusTraversalKeys_NoIDCheck(int id)
           
 Set getFocusTraversalKeys(int id)
          Suppressed: Returns the Set of focus traversal keys for a given traversal operation for this Component.
 boolean getFocusTraversalKeysEnabled()
          Suppressed: Returns whether focus traversal keys are enabled for this Component.
(package private)  Font getFont_NoClientCode()
           
 Font getFont()
          Enabled: Gets the font of this component.
 FontMetrics getFontMetrics(Font font)
          Enabled: Gets the font metrics for the specified font.
 Color getForeground()
          Enabled: Gets the foreground color of this component.
 Graphics getGraphics()
          Enabled: Creates a graphics context for this component.
 GraphicsConfiguration getGraphicsConfiguration()
          Suppressed: Gets the GraphicsConfiguration associated with this Component.
 int getHeight()
          Enabled: Returns the current height of this component.
 HierarchyBoundsListener[] getHierarchyBoundsListeners()
          Suppressed: Returns an array of all the hierarchy bounds listeners registered on this component.
 HierarchyListener[] getHierarchyListeners()
          Suppressed: Returns an array of all the hierarchy listeners registered on this component.
 boolean getIgnoreRepaint()
          Suppressed: @return whether or not paint messages received from the operating system should be ignored.
 java.awt.im.InputContext getInputContext()
          Suppressed: Gets the input context used by this component for handling the communication with input methods when text is entered in this component.
 InputMethodListener[] getInputMethodListeners()
          Suppressed: Returns an array of all the input method listeners registered on this component.
 java.awt.im.InputMethodRequests getInputMethodRequests()
          Suppressed: Gets the input method request handler which supports requests from input methods for this component.
 KeyListener[] getKeyListeners()
          Suppressed: Returns an array of all the key listeners registered on this component.
 EventListener[] getListeners(Class listenerType)
          Suppressed: Returns an array of all the objects currently registered as FooListeners upon this Component.
 Locale getLocale()
          Suppressed: Gets the locale of this component.
 Point getLocation()
          Enabled: Gets the location of this component in the form of a point specifying the component's top-left corner.
 Point getLocation(Point rv)
          Suppressed: Stores the x,y origin of this component into "return value" rv and return rv.
(package private)  Point getLocationOnScreen_NoTreeLock()
           
 Point getLocationOnScreen()
          Enabled: Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space.
 Dimension getMaximumSize()
          Enabled: Gets the maximum size of this component.
 Dimension getMinimumSize()
          Enabled: Gets the mininimum size of this component.
 MouseListener[] getMouseListeners()
          Suppressed: Returns an array of all the mouse listeners registered on this component.
 MouseMotionListener[] getMouseMotionListeners()
          Suppressed: Returns an array of all the mouse motion listeners registered on this component.
 MouseWheelListener[] getMouseWheelListeners()
          Suppressed: Returns an array of all the mouse wheel listeners registered on this component.
 String getName()
          Enabled: Gets the name of the component.
(package private)  Container getNativeContainer()
           
(package private)  Container getParent_NoClientCode()
           
 Container getParent()
          Suppressed: Gets the parent of this component.
 java.awt.peer.ComponentPeer getPeer()
          Suppressed: @deprecated As of JDK version 1.1, programs should not directly manipulate peers; replaced by boolean isDisplayable().
 Dimension getPreferredSize()
          Enabled: Gets the preferred size of this component.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners()
          Suppressed: Returns an array of all the property change listeners registered on this component.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
          Suppressed: Returns an array of all the listeners which have been associated with the named property.
 Dimension getSize()
          Enabled: Returns the size of this component in the form of a Dimension object.
 Dimension getSize(Dimension rv)
          Suppressed: Stores the width/height of this component into "return value" rv and return rv.
 Toolkit getToolkit()
          Suppressed: Gets the toolkit of this component.
(package private)  Toolkit getToolkitImpl()
           
 Object getTreeLock()
          Suppressed: Gets this component's locking object (the object that owns the thread sychronization monitor) for AWT component-tree and layout operations.
 int getWidth()
          Enabled: Returns the current width of this component.
 int getX()
          Enabled: Returns the current x coordinate of the components origin.
 int getY()
          Enabled: Returns the current y coordinate of the components origin.
 boolean gotFocus(Event evt, Object what)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).
 boolean handleEvent(Event evt)
          Suppressed: @deprecated As of JDK version 1.1 replaced by processEvent(AWTEvent).
 boolean hasFocus()
          Enabled: Returns true if this Component is the focus owner.
 void hide()
          Suppressed: @deprecated As of JDK version 1.1, replaced by setVisible(boolean).
 boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)
          Enabled: Repaints the component when the image has changed.
(package private)  void initializeFocusTraversalKeys()
           
private static void initIDs()
          Initialize JNI field and method IDs
 boolean inside(int x, int y)
          Suppressed: @deprecated As of JDK version 1.1, replaced by contains(int, int).
 void invalidate()
          Enabled: Invalidates this component.
 boolean isBackgroundSet()
          Enabled: Returns whether the background color has been explicitly set for this Component.
 boolean isCursorSet()
          Enabled: Returns whether the cursor has been explicitly set for this Component.
 boolean isDisplayable()
          Enabled: Determines whether this component is displayable.
 boolean isDoubleBuffered()
          Enabled: Returns true if this component is painted to an offscreen image ("buffer") that's copied to the screen later.
 boolean isEnabled()
          Enabled: Determines whether this component is enabled.
(package private)  boolean isEnabledImpl()
           
 boolean isFocusable()
          Suppressed: Returns whether this Component can be focused.
 boolean isFocusCycleRoot(Container container)
          Suppressed: Returns whether the specified Container is the focus cycle root of this Component's focus traversal cycle.
 boolean isFocusOwner()
          Suppressed: Returns true if this Component is the focus owner.
 boolean isFocusTraversable()
          Deprecated. As of 1.4, replaced by isFocusable().
(package private)  boolean isFocusTraversableOverridden()
           
 boolean isFontSet()
          Enabled: Returns whether the font has been explicitly set for this Component.
 boolean isForegroundSet()
          Enabled: Returns whether the foreground color has been explicitly set for this Component.
 boolean isLightweight()
          Suppressed: A lightweight component doesn't have a native toolkit peer.
 boolean isOpaque()
          Enabled: Returns true if this component is completely opaque, returns false by default.
(package private)  boolean isRecursivelyVisible()
          Determines whether this component will be displayed on the screen if it's displayable.
 boolean isShowing()
          Enabled: Determines whether this component is showing on screen.
 boolean isValid()
          Enabled: Determines whether this component is valid.
 boolean isVisible()
          Enabled: Determines whether this component should be visible when its parent is visible.
 void iterate(AssocFunc func)
          Added: A Component enumerates no components, unless it's also a Container.
 boolean keyDown(Event evt, int key)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).
 boolean keyUp(Event evt, int key)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processKeyEvent(KeyEvent).
 void layout()
          Suppressed: @deprecated As of JDK version 1.1, replaced by doLayout().
(package private)  void lightweightPaint(Graphics g)
          Simulates the peer callbacks into java.awt for painting of lightweight Components.
(package private)  void lightweightPrint(Graphics g)
          Simulates the peer callbacks into java.awt for printing of lightweight Components.
 void list()
          Suppressed: Prints a listing of this component to the standard system output stream System.out.
 void list(PrintStream out)
          Suppressed: Prints a listing of this component to the specified output stream.
 void list(PrintStream out, int indent)
          Suppressed: Prints out a list, starting at the specified indentation, to the specified print stream.
 void list(PrintWriter out)
          Suppressed: Prints a listing to the specified print writer.
 void list(PrintWriter out, int indent)
          Suppressed: Prints out a list, starting at the specified indentation, to the specified print writer.
 Component locate(int x, int y)
          Suppressed: @deprecated As of JDK version 1.1, replaced by getComponentAt(int, int).
 Point location()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getLocation().
 boolean lostFocus(Event evt, Object what)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processFocusEvent(FocusEvent).
 Dimension minimumSize()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getMinimumSize().
 boolean mouseDown(Event evt, int x, int y)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).
 boolean mouseDrag(Event evt, int x, int y)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).
 boolean mouseEnter(Event evt, int x, int y)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).
 boolean mouseExit(Event evt, int x, int y)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).
 boolean mouseMove(Event evt, int x, int y)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processMouseMotionEvent(MouseEvent).
 boolean mouseUp(Event evt, int x, int y)
          Suppressed: @deprecated As of JDK version 1.1, replaced by processMouseEvent(MouseEvent).
 void move(int x, int y)
          Suppressed: @deprecated As of JDK version 1.1, replaced by setLocation(int, int).
 void nextFocus()
          Suppressed: @deprecated As of JDK version 1.1, replaced by transferFocus().
(package private)  boolean nextFocusHelper()
           
(package private)  int numListening(long mask)
           
 void paint(Graphics g)
          Suppressed: Paints this component.
 void paintAll(Graphics g)
          Suppressed: Paints this component and all of its subcomponents.
(package private)  void paintHeavyweightComponents(Graphics g)
          Paints all the heavyweight subcomponents.
protected  String paramString()
          Returns a string representing the state of this component.
 boolean postEvent(Event e)
          Suppressed: @deprecated As of JDK version 1.1, replaced by dispatchEvent(AWTEvent).
(package private)  boolean postsOldMouseEvents()
           
 Dimension preferredSize()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getPreferredSize().