Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.swing
Class JComponent

    java.lang.Object
      |
      +--java.awt.Component
            |
            +--java.awt.Container
                  |
                  +--javax.swing.JComponent

All Implemented Interfaces:
  ImageObserver, MenuContainer, Serializable

Direct Known Subclasses:
  AbstractButton, BasicInternalFrameTitlePane, JColorChooser, JComboBox, JFileChooser, JInternalFrame, JInternalFrame.JDesktopIcon, JLabel, JLayeredPane, JList, JMenuBar, JOptionPane, JPanel, JPopupMenu, JProgressBar, JRootPane, JScrollBar, JScrollPane, JSeparator, JSlider, JSplitPane, JTabbedPane, JTable, JTableHeader, JTextComponent, JToolBar, JToolTip, JTree, JViewport

public abstract class JComponent
extends Container
implements Serializable

The base class for all Swing components except top-level containers. To use a component that inherits from `JComponent`, you must place the component in a containment hierarchy whose root is a top-level Swing container. Top-level Swing containers -- such as `JFrame`, `JDialog`, and `JApplet` -- are specialized components that provide a place for other Swing components to paint themselves. For an explanation of containment hierarchies, see Swing Components and the Containment Hierarchy, a section in The Java Tutorial.

The `JComponent` class provides:

- The base class for both standard and custom components that use the Swing architecture.
- A "pluggable look and feel" (L&F) that can be specified by the programmer or (optionally) selected by the user at runtime. See How to Set the Look and Feel in The Java Tutorial for more information.
- Comprehensive keystroke handling. See the document Keyboard Bindings in Swing, an article in The Swing Connection, for more information.
- Support for tool tips -- short descriptions that pop up when the cursor lingers over a component. See How to Use Tool Tips in The Java Tutorial for more information.
- Support for accessibility. `JComponent` contains all of the methods in the `Accessible` interface, but it doesn't actually implement the interface. That is the responsibility of the individual classes that extend `JComponent`.
- Support for component-specific properties. With the `putClientProperty(java.lang.Object, java.lang.Object)` and `getClientProperty(java.lang.Object)` methods, you can associate name-object pairs with any object that descends from `JComponent`.
- An infrastructure for painting that includes double buffering and support for borders. For more information see Painting and How to Use Borders, both of which are sections in The Java Tutorial.

For more information on these subjects, see the Swing package description and The Java Tutorial section The JComponent Class.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

See Also:
  `KeyStroke`, `Action`, `setBorder(javax.swing.border.Border)`, `registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)`, `JOptionPane`, `setDebugGraphicsOptions(int)`, `setToolTipText(java.lang.String)`, `setAutoscrolls(boolean)`, Serialized Form

Inner Class Summary
`class` | `JComponent.AccessibleJComponent` Inner class of JComponent used to provide default support for accessibility.

Inner classes inherited from class java.awt.Container
`Container.AccessibleAWTContainer`

Inner classes inherited from class java.awt.Component
`Component.AccessibleAWTComponent`

Field Summary
`protected AccessibleContext` | `accessibleContext` The AccessibleContext associated with this JComponent.
`protected EventListenerList` | `listenerList`
`static String` | `TOOL_TIP_TEXT_KEY` The comment to display when the cursor is over the component, also known as a "value tip", "flyover help", or "flyover label".
`protected ComponentUI` | `ui`
`static int` | `UNDEFINED_CONDITION` Constant used by some of the APIs to mean that no condition is defined.
`static int` | `WHEN_ANCESTOR_OF_FOCUSED_COMPONENT` Constant used for registerKeyboardAction() that means that the command should be invoked when the receiving component is an ancestor of the focused component or is itself the focused component.
`static int` | `WHEN_FOCUSED` Constant used for registerKeyboardAction() that means that the command should be invoked when the component has the focus.
`static int` | `WHEN_IN_FOCUSED_WINDOW` Constant used for registerKeyboardAction() that means that the command should be invoked when the receiving component is in the window that has the focus or is itself the focused component.

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`JComponent()` Default JComponent constructor.

Method Summary
`void` | `addAncestorListener(AncestorListener listener)` Registers listener so that it will receive AncestorEvents when it or any of its ancestors move or are made visible / invisible.
`void` | `addNotify()` Notifies this component that it now has a parent component.
`void` | `addPropertyChangeListener(PropertyChangeListener listener)` Adds a PropertyChangeListener to the listener list.
`void` | `addPropertyChangeListener(String propertyName, PropertyChangeListener listener)` Adds a PropertyChangeListener for a specific property.
`void` | `addVetoableChangeListener(VetoableChangeListener listener)` Adds a VetoableChangeListener to the listener list.
`void` | `computeVisibleRect(Rectangle visibleRect)` Returns the Component's "visible rect rectangle" - the intersection of the visible rectangles for this component and all of its ancestors.
`boolean` | `contains(int x, int y)` Gives the UI delegate an opportunity to define the precise shape of this component for the sake of mouse processing.
`JToolTip` | `createToolTip()` Returns the instance of JToolTip that should be used to display the tooltip.
`void` | `disable()` overridden to ensure Accessibility support
`void` | `enable()` overridden to ensure Accessibility support
`void` | `firePropertyChange(String propertyName, boolean oldValue, boolean newValue)` Reports a bound property change.
`void` | `firePropertyChange(String propertyName, byte oldValue, byte newValue)` Reports a bound property change.
`void` | `firePropertyChange(String propertyName, char oldValue, char newValue)` Reports a bound property change.
`void` | `firePropertyChange(String propertyName, double oldValue, double newValue)` Reports a bound property change.
`void` | `firePropertyChange(String propertyName, float oldValue, float newValue)` Reports a bound property change.
`void` | `firePropertyChange(String propertyName, int oldValue, int newValue)` Reports a bound property change.
`void` | `firePropertyChange(String propertyName, long oldValue, long newValue)` Reports a bound property change.
`protected void` | `firePropertyChange(String propertyName, Object oldValue, Object newValue)` Supports reporting bound property changes.
`void` | `firePropertyChange(String propertyName, short oldValue, short newValue)` Reports a bound property change.
`protected void` | `fireVetoableChange(String propertyName, Object oldValue, Object newValue)` Supports reporting constrained property changes.
`AccessibleContext` | `getAccessibleContext()` Gets the AccessibleContext associated with this JComponent.
`ActionListener` | `getActionForKeyStroke(KeyStroke aKeyStroke)` Returns the object that will perform the action registered for a given keystroke.
`ActionMap` | `getActionMap()` Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding.
`float` | `getAlignmentX()` Overrides `Container.getAlignmentX` to return the vertical alignment.
`float` | `getAlignmentY()` Overrides `Container.getAlignmentY` to return the horizontal alignment.
`boolean` | `getAutoscrolls()` Returns true if this component automatically scrolls its contents when dragged (when contained in a component that supports scrolling, like JViewport).
`Border` | `getBorder()` Returns the border of this component or null if no border is currently set.
`Rectangle` | `getBounds(Rectangle rv)` Stores the bounds of this component into "return value" rv and returns rv.
`Object` | `getClientProperty(Object key)` Returns the value of the property with the specified key.
`protected Graphics` | `getComponentGraphics(Graphics g)` Returns the graphics object used to paint this component.
`int` | `getConditionForKeyStroke(KeyStroke aKeyStroke)` Returns the condition that determines whether a registered action occurs in response to the specified keystroke.
`int` | `getDebugGraphicsOptions()` Returns the state of graphics debugging.
`Graphics` | `getGraphics()` Returns this component's graphics context, which lets you draw on a component.
`int` | `getHeight()` Returns the current height of this component.
`InputMap` | `getInputMap()` Returns the InputMap that is used when the receiver has focus.
`InputMap` | `getInputMap(int condition)` Returns the InputMap that is used during `condition`.
`InputVerifier` | `getInputVerifier()` Returns the input verifier for this component.
`Insets` | `getInsets()` If a border has been set on this component, returns the border's insets; otherwise calls super.getInsets.
`Insets` | `getInsets(Insets insets)` Returns an Insets object containing this component's inset values.
`EventListener[]` | `getListeners(Class listenerType)` Return an array of all the listeners that were added to this JComponent with addXXXListener(), where XXX is the name of the `listenerType` argument.
`Point` | `getLocation(Point rv)` Stores the x,y origin of this component into "return value" rv and returns rv.
`Dimension` | `getMaximumSize()` If the maximum size has been set to a non-null value just returns it.
`Dimension` | `getMinimumSize()` If the minimum size has been set to a non-null value just returns it.
`Component` | `getNextFocusableComponent()` Returns the next focusable component or null if the focus manager should choose the next focusable component automatically.
`Dimension` | `getPreferredSize()` If the preferredSize has been set to a non-null value just returns it.
`KeyStroke[]` | `getRegisteredKeyStrokes()` Returns the KeyStrokes that will initiate registered actions.
`JRootPane` | `getRootPane()` Returns the JRootPane ancestor for a component
`Dimension` | `getSize(Dimension rv)` Stores the width/height of this component into "return value" rv and returns rv.
`Point` | `getToolTipLocation(MouseEvent event)` Returns the tooltip location in this component's coordinate system.
`String` | `getToolTipText()` Returns the tooltip string that has been set with setToolTipText().
`String` | `getToolTipText(MouseEvent event)` Returns the string to be used as the tooltip for event.
`Container` | `getTopLevelAncestor()` Returns the top-level ancestor of this component (either the containing Window or Applet), or null if this component has not been added to any container.
`String` | `getUIClassID()` Returns the UIDefaults key used to look up the name of the swing.plaf.ComponentUI class that defines the look and feel for this component.
`boolean` | `getVerifyInputWhenFocusTarget()` Get the value that indicates whether the input verifier for the current focus owner will be called before this component requests focus.
`Rectangle` | `getVisibleRect()` Returns the Component's "visible rectangle" - the intersection of this component's visible rectangle:
`int` | `getWidth()` Returns the current width of this component.
`int` | `getX()` Returns the current x coordinate of the component's origin.
`int` | `getY()` Returns the current y coordinate of the component's origin.
`void` | `grabFocus()` Sets the focus on the receiving component if it doesn't already have it.
`boolean` | `hasFocus()` Returns true if this Component has the keyboard focus.
`void` | `hide()` Deprecated. As of JDK version 1.1, replaced by `setVisible(boolean)`.
`boolean` | `isDoubleBuffered()` Returns whether the receiving component should use a buffer to paint.
`boolean` | `isFocusCycleRoot()` Override this method and return true if your component is the root of of a component tree with its own focus cycle.
`boolean` | `isFocusTraversable()` Identifies whether or not this component can receive the focus.
`static boolean` | `isLightweightComponent(Component c)` Returns true if this component is a lightweight, that is, if it doesn't have a native window system peer.
`boolean` | `isManagingFocus()` Override this method and return true if your JComponent manages focus.
`boolean` | `isMaximumSizeSet()` Returns true if the maximum size has been set to a non-null value otherwise returns false.
`boolean` | `isMinimumSizeSet()` Returns true if the minimum size has been set to a non-null value otherwise returns false.
`boolean` | `isOpaque()` Returns true if this component is completely opaque.
`boolean` | `isOptimizedDrawingEnabled()` Returns true if this component tiles its children -- that is, if it can guarantee that the children will not overlap.
`boolean` | `isPaintingTile()` Returns true if the receiving component is currently painting a tile.
`boolean` | `isPreferredSizeSet()` Returns true if the preferred size has been set to a non-null value otherwise returns false.
`boolean` | `isRequestFocusEnabled()` Returns whether the receiving component can obtain the focus by calling requestFocus.
`boolean` | `isValidateRoot()` If this method returns true, revalidate() calls by descendants of this component will cause the entire tree beginning with this root to be validated.
`void` | `paint(Graphics g)` This method is invoked by Swing to draw components.
`protected void` | `paintBorder(Graphics g)` Paints the component's border.
`protected void` | `paintChildren(Graphics g)` Paints this component's children.
`protected void` | `paintComponent(Graphics g)` If the UI delegate is non-null, calls its paint method.
`void` | `paintImmediately(int x, int y, int w, int h)` Paints the specified region in this component and all of its descendants that overlap the region, immediately.
`void` | `paintImmediately(Rectangle r)` Paints the specified region now.
`protected String` | `paramString()` Returns a string representation of this JComponent.
`void` | `print(Graphics g)` Invoke this method to print the receiver.
`void` | `printAll(Graphics g)` Invoke this method to print the receiver.
`protected void` | `printBorder(Graphics g)` Prints the component's border.
`protected void` | `printChildren(Graphics g)` Prints this component's children.
`protected void` | `printComponent(Graphics g)` This is invoked during a printing operation.
`protected void` | `processComponentKeyEvent(KeyEvent e)` Processes any key events that the component itself recognizes.
`protected void` | `processFocusEvent(FocusEvent e)` Processes focus events occurring on this component by dispatching them to any registered `FocusListener` objects.
`protected boolean` | `processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)` Invoked to process the key bindings for `ks` as the result of the KeyEvent `e`.
`protected void` | `processKeyEvent(KeyEvent e)` Overrides processKeyEvent to process events.
`protected void` | `processMouseMotionEvent(MouseEvent e)` Processes mouse motion events occurring on this component by dispatching them to any registered `MouseMotionListener` objects.
`void` | `putClientProperty(Object key, Object value)` Adds an arbitrary key/value "client property" to this component.
`void` | `registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)` This method is now obsolete, please use a combination of `getActionMap()` and `getInputMap()` for similiar behavior.
`void` | `registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition)` This method is now obsolete, please use a combination of `getActionMap()` and `getInputMap()` for similiar behavior.
`void` | `removeAncestorListener(AncestorListener listener)` Unregisters listener so that it will no longer receive AncestorEvents
`void` | `removeNotify()` Notifies this component that it no longer has a parent component.
`void` | `removePropertyChangeListener(PropertyChangeListener listener)` Removes a PropertyChangeListener from the listener list.
`void` | `removePropertyChangeListener(String propertyName, PropertyChangeListener listener)` Removes a PropertyChangeListener for a specific property.
`void` | `removeVetoableChangeListener(VetoableChangeListener listener)` Removes a VetoableChangeListener from the listener list.
`void` | `repaint(long tm, int x, int y, int width, int height)` Adds the specified region to the dirty region list if the component is showing.
`void` | `repaint(Rectangle r)` Adds the specified region to the dirty region list if the component is showing.
`boolean` | `requestDefaultFocus()` Requests the focus for the component that should have the focus by default.
`void` | `requestFocus()` Sets focus on the receiving component if isRequestFocusEnabled returns true and the component doesn't already have focus.
`void` | `resetKeyboardActions()` Unregisters all the bindings in the first tier InputMaps and ActionMap.
`void` | `reshape(int x, int y, int w, int h)` Moves and resizes this component.
`void` | `revalidate()` Supports deferred automatic layout.
`void` | `scrollRectToVisible(Rectangle aRect)` Forwards the scrollRectToVisible() message to the JComponent's parent.
`void` | `setActionMap(ActionMap am)` Sets the ActionMap to `am`.
`void` | `setAlignmentX(float alignmentX)` Sets the the vertical alignment.
`void` | `setAlignmentY(float alignmentY)` Sets the the horizontal alignment.
`void` | `setAutoscrolls(boolean autoscrolls)` If true this component will automatically scroll its contents when dragged, if contained in a component that supports scrolling, such as JViewport.
`void` | `setBackground(Color bg)` Sets the background color of this component.
`void` | `setBorder(Border border)` Sets the border of this component.
`void` | `setDebugGraphicsOptions(int debugOptions)` Enables or disables diagnostic information about every graphics operation performed within the component or one of its children.
`void` | `setDoubleBuffered(boolean aFlag)` Sets whether the receiving component should use a buffer to paint.
`void` | `setEnabled(boolean enabled)` Sets whether or not this component is enabled.
`void` | `setFont(Font font)` Sets the font for this component.
`void` | `setForeground(Color fg)` Sets the foreground color of this component.
`void` | `setInputMap(int condition, InputMap map)` Sets the InputMap to use under the condition `condition` to `map`.
`void` | `setInputVerifier(InputVerifier inputVerifier)` Sets the input verifier for this component.
`void` | `setMaximumSize(Dimension maximumSize)` Sets the maximum size of this component to a constant value.
`void` | `setMinimumSize(Dimension minimumSize)` Sets the minimum size of this component to a constant value.
`void` | `setNextFocusableComponent(Component aComponent)` Specifies the next component to get the focus after this one, for example, when the tab key is pressed.
`void` | `setOpaque(boolean isOpaque)` If true the component paints every pixel within its bounds.
`void` | `setPreferredSize(Dimension preferredSize)` Sets the preferred size of the receiving component.
`void` | `setRequestFocusEnabled(boolean aFlag)` Sets whether the receiving component can obtain the focus by calling requestFocus.
`void` | `setToolTipText(String text)` Registers the text to display in a tool tip.
`protected void` | `setUI(ComponentUI newUI)` Sets the look and feel delegate for this component.
`void` | `setVerifyInputWhenFocusTarget(boolean flag)` Set the value to indicate whether input verifier for the current focus owner will be called before this component requests focus.
`void` | `setVisible(boolean aFlag)` Makes the component visible or invisible.
`void` | `unregisterKeyboardAction(KeyStroke aKeyStroke)` This method is now obsolete.
`void` | `update(Graphics g)` Calls paint(g).
`void` | `updateUI()` Resets the UI property to a value from the current look and feel.

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### ui

    protected transient ComponentUI ui

### listenerList

    protected EventListenerList listenerList

### WHEN_FOCUSED

    public static final int WHEN_FOCUSED

  Constant used for registerKeyboardAction() that means that the command should be invoked when the component has the focus.

### WHEN_ANCESTOR_OF_FOCUSED_COMPONENT

    public static final int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT

  Constant used for registerKeyboardAction() that means that the command should be invoked when the receiving component is an ancestor of the focused component or is itself the focused component.

### WHEN_IN_FOCUSED_WINDOW

    public static final int WHEN_IN_FOCUSED_WINDOW

  Constant used for registerKeyboardAction() that means that the command should be invoked when the receiving component is in the window that has the focus or is itself the focused component.

### UNDEFINED_CONDITION

    public static final int UNDEFINED_CONDITION

  Constant used by some of the APIs to mean that no condition is defined.

### TOOL_TIP_TEXT_KEY

    public static final String TOOL_TIP_TEXT_KEY

  The comment to display when the cursor is over the component, also known as a "value tip", "flyover help", or "flyover label".

### accessibleContext

    protected AccessibleContext accessibleContext

  The AccessibleContext associated with this JComponent.

Constructor Detail

### JComponent

    public JComponent()

  Default JComponent constructor. This constructor does no initialization beyond calling the Container constructor. For example, the initial layout manager is null.

Method Detail

### updateUI

    public void updateUI()

  Resets the UI property to a value from the current look and feel. JComponent subclasses must override this method like this:

         public void updateUI() {
            setUI((SliderUI)UIManager.getUI(this);
         }

  See Also:
    `setUI(javax.swing.plaf.ComponentUI)`, `UIManager.getLookAndFeel()`, `UIManager.getUI(javax.swing.JComponent)`

### setUI

    protected void setUI(ComponentUI newUI)

  Sets the look and feel delegate for this component. JComponent subclasses generally override this method to narrow the argument type. For example, in JSlider:

       public void setUI(SliderUI newUI) {
           super.setUI(newUI);
       }

  Additionally JComponent subclasses must provide a getUI method that returns the correct type. For example:

       public SliderUI getUI() {
           return (SliderUI)ui;
       }

  See Also:
    `updateUI()`, `UIManager.getLookAndFeel()`, `UIManager.getUI(javax.swing.JComponent)`

### getUIClassID

    public String getUIClassID()

  Returns the UIDefaults key used to look up the name of the swing.plaf.ComponentUI class that defines the look and feel for this component. Most applications will never need to call this method. Subclasses of JComponent that support pluggable look and feel should override this method to return a UIDefaults key that maps to the ComponentUI subclass that defines their look and feel.
  Returns:
    The UIDefaults key for a ComponentUI subclass.
  See Also:
    `UIDefaults.getUI(javax.swing.JComponent)`

### getComponentGraphics

    protected Graphics getComponentGraphics(Graphics g)

  Returns the graphics object used to paint this component. If DebugGraphics is turned on we create a new DebugGraphics object if necessary. Otherwise we just configure the specified graphics object's foreground and font.
  Returns:
    a Graphics object configured for this component

### paintComponent

    protected void paintComponent(Graphics g)

  If the UI delegate is non-null, calls its paint method. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (for example, Graphics.translate()).
  See Also:
    `paint(java.awt.Graphics)`

### paintChildren

    protected void paintChildren(Graphics g)

  Paints this component's children. If shouldUseBuffer is true, no component ancestor has a buffer and the component children can use a buffer if they have one. Otherwise, one ancestor has a buffer currently in use and children should not use a buffer to paint.
  See Also:
    `paint(java.awt.Graphics)`, `Container.paint(java.awt.Graphics)`

### paintBorder

    protected void paintBorder(Graphics g)

  Paints the component's border.
  See Also:
    `paint(java.awt.Graphics)`, `setBorder(javax.swing.border.Border)`

### update

    public void update(Graphics g)

  Calls paint(g). Doesn't clear the background but see ComponentUI.update(), which is called by paintComponent.
  Overrides:
    `update` in class `Container`
  See Also:
    `paint(java.awt.Graphics)`, `paintComponent(java.awt.Graphics)`, `ComponentUI`

### paint

    public void paint(Graphics g)

  This method is invoked by Swing to draw components. Applications should not invoke paint directly, but should instead use the `repaint` method to schedule the component for redrawing.

  This method actually delegates the work of painting to three protected methods: `paintComponent`, `paintBorder`, and `paintChildren`. They're called in the order listed to ensure that children appear on top of component itself. Generally speaking, the component and its children should not paint in the insets area allocated to the border. Subclasses can just override this method, as always. A subclass that just wants to specialize the UI (look and feel) delegate's paint method should just override `paintComponent`.

  Overrides:
    `paint` in class `Container`
  See Also:
    `paintComponent(java.awt.Graphics)`, `paintBorder(java.awt.Graphics)`, `paintChildren(java.awt.Graphics)`, `getComponentGraphics(java.awt.Graphics)`, `repaint(long, int, int, int, int)`

### printAll

    public void printAll(Graphics g)

  Invoke this method to print the receiver. This method invokes `print` on the receiver.
  Overrides:
    `printAll` in class `Component`
  See Also:
    `print(java.awt.Graphics)`, `printComponent(java.awt.Graphics)`, `printBorder(java.awt.Graphics)`, `printChildren(java.awt.Graphics)`

### print

    public void print(Graphics g)

  Invoke this method to print the receiver. This method will result in invocations to `printComponent`, `printBorder` and `printChildren`. It is not recommended that you override this method, instead override one of the previously metioned methods. This method sets the receivers state such that the double buffer will not be used, eg painting will be done directly on the passed in Graphics.
  Overrides:
    `print` in class `Container`
  See Also:
    `printComponent(java.awt.Graphics)`, `printBorder(java.awt.Graphics)`, `printChildren(java.awt.Graphics)`

### printComponent

    protected void printComponent(Graphics g)

  This is invoked during a printing operation. This is implemented to invoke `paintComponent` on the receiver. Override this if you wish to add special painting behavior when printing.
  Since:
    1.3
  See Also:
    `print(java.awt.Graphics)`

### printChildren

    protected void printChildren(Graphics g)

  Prints this component's children. This is implemented to invoke `paintChildren` on the receiver. Override this if you wish to print the children differently than painting.
  Since:
    1.3
  See Also:
    `print(java.awt.Graphics)`

### printBorder

    protected void printBorder(Graphics g)

  Prints the component's border. This is implemented to invoke `paintBorder` on the receiver. Overrides this if you wish to print the border differently that it is painted.
  Since:
    1.3
  See Also:
    `print(java.awt.Graphics)`

### isPaintingTile

    public boolean isPaintingTile()

  Returns true if the receiving component is currently painting a tile. If this method returns true, paint will be called again for another tile. This method returns false if you are not painting a tile or if the last tile is painted. Use this method to keep some state you might need between tiles.

### isFocusCycleRoot

    public boolean isFocusCycleRoot()

  Override this method and return true if your component is the root of of a component tree with its own focus cycle.

### isManagingFocus

    public boolean isManagingFocus()

  Override this method and return true if your JComponent manages focus. If your component manages focus, the focus manager will handle your component's children. All key event will be sent to your key listener including TAB and SHIFT+TAB. CONTROL+TAB and CONTROL+SHIFT+TAB will move the focus to the next or previous component.

### setNextFocusableComponent

    public void setNextFocusableComponent(Component aComponent)

  Specifies the next component to get the focus after this one, for example, when the tab key is pressed. Invoke this method to override the default focus-change sequence.

### getNextFocusableComponent

    public Component getNextFocusableComponent()

  Returns the next focusable component or null if the focus manager should choose the next focusable component automatically.

### setRequestFocusEnabled

    public void setRequestFocusEnabled(boolean aFlag)

  Sets whether the receiving component can obtain the focus by calling requestFocus. The default value is true. Note: Setting this property to false will not prevent the focus manager from setting the focus to this component, it will prevent the component from getting the focus when the focus is requested explicitly. Override isFocusTraversable and return false if the component should never get the focus.

### isRequestFocusEnabled

    public boolean isRequestFocusEnabled()

  Returns whether the receiving component can obtain the focus by calling requestFocus.
  See Also:
    `setRequestFocusEnabled(boolean)`

### requestFocus

    public void requestFocus()

  Sets focus on the receiving component if isRequestFocusEnabled returns true and the component doesn't already have focus.
  Overrides:
    `requestFocus` in class `Component`
  Following copied from class: `java.awt.Component`
  See Also:
    `FocusEvent`, `Component.addFocusListener(java.awt.event.FocusListener)`, `Component.processFocusEvent(java.awt.event.FocusEvent)`, `Component.isFocusTraversable()`

### grabFocus

    public void grabFocus()

  Sets the focus on the receiving component if it doesn't already have it. This method is for focus managers. You rarely want to call this method; use requestFocus() instead.

### setVerifyInputWhenFocusTarget

    public void setVerifyInputWhenFocusTarget(boolean flag)

  Set the value to indicate whether input verifier for the current focus owner will be called before this component requests focus. The default is true. Set to false on components such as a Cancel button or a scrollbar, which should activate even if the input in the current focus owner is not "passed" by the input verifier for that component.
  Parameters:
    `new` - value for the verifyInputWhenFocusTarget property
  Since:
    1.3
  See Also:
    `InputVerifier`, `setInputVerifier(javax.swing.InputVerifier)`, `getInputVerifier()`, `getVerifyInputWhenFocusTarget()`

### getVerifyInputWhenFocusTarget

    public boolean getVerifyInputWhenFocusTarget()

  Get the value that indicates whether the input verifier for the current focus owner will be called before this component requests focus.
  Returns:
    value of the verifyInputWhenFocusTarget property
  Since:
    1.3
  See Also:
    `InputVerifier`, `setInputVerifier(javax.swing.InputVerifier)`, `getInputVerifier()`, `setVerifyInputWhenFocusTarget(boolean)`

### setPreferredSize

    public void setPreferredSize(Dimension preferredSize)

  Sets the preferred size of the receiving component. If `preferredSize` is null, the UI will be asked for the preferred size.

### getPreferredSize

    public Dimension getPreferredSize()

  If the preferredSize has been set to a non-null value just returns it. If the UI delegate's getPreferredSize() method returns a non null value then return that; otherwise defer to the component's layout manager.
  Overrides:
    `getPreferredSize` in class `Container`
  Returns:
    the value of the preferredSize property
  See Also:
    `setPreferredSize(java.awt.Dimension)`

### setMaximumSize

    public void setMaximumSize(Dimension maximumSize)

  Sets the maximum size of this component to a constant value. Subsequent calls to getMaximumSize will always return this value; the component's UI will not be asked to compute it. Setting the maximum size to null restores the default behavior.
  See Also:
    `getMaximumSize()`

### getMaximumSize

    public Dimension getMaximumSize()

  If the maximum size has been set to a non-null value just returns it. If the UI delegate's getMaximumSize() method returns a non null value then return that; otherwise defer to the component's layout manager.
  Overrides:
    `getMaximumSize` in class `Container`
  Returns:
    the value of the maximumSize property.
  See Also:
    `setMaximumSize(java.awt.Dimension)`

### setMinimumSize

    public void setMinimumSize(Dimension minimumSize)

  Sets the minimum size of this component to a constant value. Subsequent calls to getMinimumSize will always return this value; the component's UI will not be asked to compute it. Setting the minimum size to null restores the default behavior.
  See Also:
    `getMinimumSize()`

### getMinimumSize

    public Dimension getMinimumSize()

  If the minimum size has been set to a non-null value just returns it. If the UI delegate's getMinimumSize() method returns a non-null value then return that; otherwise defer to the component's layout manager.
  Overrides:
    `getMinimumSize` in class `Container`
  Returns:
    the value of the minimumSize property
  See Also:
    `setMinimumSize(java.awt.Dimension)`

### isMinimumSizeSet

    public boolean isMinimumSizeSet()

  Returns true if the minimum size has been set to a non-null value otherwise returns false.

### isPreferredSizeSet

    public boolean isPreferredSizeSet()

  Returns true if the preferred size has been set to a non-null value otherwise returns false.

### isMaximumSizeSet

    public boolean isMaximumSizeSet()

  Returns true if the maximum size has been set to a non-null value otherwise returns false.

### contains

    public boolean contains(int x,
                            int y)

  Gives the UI delegate an opportunity to define the precise shape of this component for the sake of mouse processing.
  Overrides:
    `contains` in class `Component`
  Returns:
    true if this component logically contains x,y
  See Also:
    `Component.contains(int, int)`

### setBorder

    public void setBorder(Border border)

  Sets the border of this component. The Border object is responsible for defining the insets for the component (overriding any insets set directly on the component) and for optionally rendering any border decorations within the bounds of those insets. Borders should be used (rather than insets) for creating both decorative and non-decorative (such as margins and padding) regions for a swing component. Compound borders can be used to nest multiple borders within a single component.

  This is a bound property.

  Parameters:
    `border` - the border to be rendered for this component
  See Also:
    `Border`, `CompoundBorder`

### getBorder

    public Border getBorder()

  Returns the border of this component or null if no border is currently set.
  Returns:
    the border object for this component
  See Also:
    `setBorder(javax.swing.border.Border)`

### getInsets

    public Insets getInsets()

  If a border has been set on this component, returns the border's insets; otherwise calls super.getInsets.
  Overrides:
    `getInsets` in class `Container`
  Returns:
    the value of the insets property
  See Also:
    `setBorder(javax.swing.border.Border)`

### getInsets

    public Insets getInsets(Insets insets)

  Returns an Insets object containing this component's inset values. The passed-in Insets object will be reused if possible. Calling methods cannot assume that the same object will be returned, however. All existing values within this object are overwritten.
  Parameters:
    `insets` - the Insets object, which can be reused
  See Also:
    `getInsets()`

### getAlignmentY

    public float getAlignmentY()

  Overrides `Container.getAlignmentY` to return the horizontal alignment.
  Overrides:
    `getAlignmentY` in class `Container`
  Returns:
    the value of the alignmentY property
  See Also:
    `setAlignmentY(float)`, `Component.getAlignmentY()`

### setAlignmentY

    public void setAlignmentY(float alignmentY)

  Sets the the horizontal alignment.
  See Also:
    `getAlignmentY()`

### getAlignmentX

    public float getAlignmentX()

  Overrides `Container.getAlignmentX` to return the vertical alignment.
  Overrides:
    `getAlignmentX` in class `Container`
  Returns:
    the value of the alignmentX property
  See Also:
    `setAlignmentX(float)`, `Component.getAlignmentX()`

### setAlignmentX

    public void setAlignmentX(float alignmentX)

  Sets the the vertical alignment.
  See Also:
    `getAlignmentX()`

### setInputVerifier

    public void setInputVerifier(InputVerifier inputVerifier)

  Sets the input verifier for this component.
  Since:
    1.3
  See Also:
    `InputVerifier`

### getInputVerifier

    public InputVerifier getInputVerifier()

  Returns the input verifier for this component.
  Since:
    1.3
  See Also:
    `InputVerifier`

### getGraphics

    public Graphics getGraphics()

  Returns this component's graphics context, which lets you draw on a component. Use this method get a Graphics object and then invoke oeprations on that object to draw on the component.
  Overrides:
    `getGraphics` in class `Component`
  Following copied from class: `java.awt.Component`
  Returns:
    A graphics context for this component, or `null` if it has none.
  See Also:
    `Component.paint(java.awt.Graphics)`

### setDebugGraphicsOptions

    public void setDebugGraphicsOptions(int debugOptions)

  Enables or disables diagnostic information about every graphics operation performed within the component or one of its children. The value of debugOptions determines how the component should display this information:
  - DebugGraphics.LOG_OPTION - causes a text message to be printed.
  - DebugGraphics.FLASH_OPTION - causes the drawing to flash several times.
  - DebugGraphics.BUFFERED_OPTION - creates an ExternalWindow that displays the operations performed on the View's offscreen buffer.
  debug is bitwise OR'd into the current value. DebugGraphics.NONE_OPTION disables debugging. A value of 0 causes no changes to the debugging options.

### getDebugGraphicsOptions

    public int getDebugGraphicsOptions()

  Returns the state of graphics debugging.
  See Also:
    `setDebugGraphicsOptions(int)`

### registerKeyboardAction

    public void registerKeyboardAction(ActionListener anAction,
                                       String aCommand,
                                       KeyStroke aKeyStroke,
                                       int aCondition)

  This method is now obsolete, please use a combination of `getActionMap()` and `getInputMap()` for similiar behavior. For example, to bind the KeyStroke `aKeyStroke` to the Action `anAction` now use:

         component.getInputMap().put(aKeyStroke, aCommand);
         component.getActionMap().put(aCommmand, anAction);

  The above assumes you want the binding to be applicable for `WHEN_FOCUSED`. To register bindings for other focus states use the `getInputMap` method that takes an integer.

  Register a new keyboard action. anAction will be invoked if a key event matching aKeyStroke occurs and aCondition is verified. The KeyStroke object defines a particular combination of a keyboard key and one or more modifiers (alt, shift, ctrl, meta).

  The aCommand will be set in the delivered event if specified.

  The Condition can be one of:

  > WHEN_FOCUSED
  >   The action will be invoked only when the keystroke occurs while the component has the focus.
  > WHEN_IN_FOCUSED_WINDOW
  >   The action will be invoked when the keystroke occurs while the component has the focus or if the component is in the window that has the focus. Note that the component need not be an immediate descendent of the window -- it can be anywhere in the window's containment hierarchy. In other words, whenever any component in the window has the focus, the action registered with this component is invoked.
  > WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
  >   The action will be invoked when the keystroke occurs while the component has the focus or if the component is an ancestor of the component that has the focus.

  The combination of keystrokes and conditions lets you define high level (semantic) action events for a specified keystroke+modifier combination (using the KeyStroke class) and direct to a parent or child of a component that has the focus, or to the component itself. In other words, in any hierarchical structure of components, an arbitrary key-combination can be immediately directed to the appropriate component in the hierarchy, and cause a specific method to be invoked (usually by way of adapter objects).

  If an action has already been registered for the receiving container, with the same charCode and the same modifiers, anAction will replace the action.

  See Also:
    `KeyStroke`

### registerKeyboardAction

    public void registerKeyboardAction(ActionListener anAction,
                                       KeyStroke aKeyStroke,
                                       int aCondition)

  This method is now obsolete, please use a combination of `getActionMap()` and `getInputMap()` for similiar behavior.

### unregisterKeyboardAction

    public void unregisterKeyboardAction(KeyStroke aKeyStroke)

  This method is now obsolete. To unregister an existing binding you can either remove the binding from the ActionMap/InputMap, or place a dummy binding the InputMap. Removing the binding from the InputMap allows bindings in parent InputMaps to be active, whereas putting a dummy binding in the InputMap effectively disables the binding from ever happening.

  Unregisters a keyboard action. This will remove the binding from the ActionMap (if it exists) as well as the InputMaps.

### getRegisteredKeyStrokes

    public KeyStroke[] getRegisteredKeyStrokes()

  Returns the KeyStrokes that will initiate registered actions.
  Returns:
    an array of KeyStroke objects
  See Also:
    `registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)`

### getConditionForKeyStroke

    public int getConditionForKeyStroke(KeyStroke aKeyStroke)

  Returns the condition that determines whether a registered action occurs in response to the specified keystroke.

  For Java 2 platform v1.3, a KeyStroke can be associated with more than one condition. For example, 'a' could be bound for the two conditions WHEN_FOCUSED and WHEN_IN_FOCUSED_WINDOW condition.

  Returns:
    the action-keystroke condition

### getActionForKeyStroke

    public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)

  Returns the object that will perform the action registered for a given keystroke.
  Returns:
    the ActionListener object invoked when the keystroke occurs

### resetKeyboardActions

    public void resetKeyboardActions()

  Unregisters all the bindings in the first tier InputMaps and ActionMap. This has the effect of removing any local bindings, and allowing the bindings defined in parent InputMap/ActionMaps (the UI is usually defined in the second tier) to persist.

### setInputMap

    public final void setInputMap(int condition,
                                  InputMap map)

  Sets the InputMap to use under the condition `condition` to `map`. A null value implies you do not want any bindings to be used, even from the UI. This will not reinstall the UI InputMap (if there was one). Condition is one of `WHEN_IN_FOCUSED_WINDOW`, `WHEN_FOCUSED` or `WHEN_ANCESTOR_OF_FOCUSED_COMPONENT`. If condition is `WHEN_IN_FOCUSED_WINDOW` and `map` is not a ComponentInputMap, an IllegalArgumentException will be thrown. Similarly, if `condition` is not one of the values just mentioned an IllegalArgumentException will be thrown.
  Parameters:
    `condition` - one of WHEN_IN_FOCUSED_WINDOW, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
  Since:
    1.3

### getInputMap

    public final InputMap getInputMap(int condition)

  Returns the InputMap that is used during `condition`.
  Parameters:
    `condition` - one of WHEN_IN_FOCUSED_WINDOW, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
  Since:
    1.3

### getInputMap

    public final InputMap getInputMap()

  Returns the InputMap that is used when the receiver has focus. This is convenience method for `getInputMap(WHEN_FOCUSED)`.
  Since:
    JDK1.3

### setActionMap

    public final void setActionMap(ActionMap am)

  Sets the ActionMap to `am`. This does not set the parent of the `am` to be the ActionMap from the UI (if there was one), it is up to the caller to have done this.
  Since:
    1.3

### getActionMap

    public final ActionMap getActionMap()

  Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding. The returned ActionMap, unless otherwise set, will have the ActionMap from the UI set as the parent.
  Since:
    1.3

### requestDefaultFocus

    public boolean requestDefaultFocus()

  Requests the focus for the component that should have the focus by default. The default implementation will recursively request the focus on the first component that is focus-traversable.
  Returns:
    false if the focus has not been set, otherwise return true

### setVisible

    public void setVisible(boolean aFlag)

  Makes the component visible or invisible. Overrides `Component.setVisible`.
  Overrides:
    `setVisible` in class `Component`
  Parameters:
    `aFlag` - true to make the component visible

### hide

    public void hide()

  Deprecated. As of JDK version 1.1, replaced by `setVisible(boolean)`.

  Overrides:
    `hide` in class `Component`

### setEnabled

    public void setEnabled(boolean enabled)

  Sets whether or not this component is enabled. A component that is enabled may respond to user input, while a component that is not enabled cannot respond to user input. Some components may alter their visual representation when they are disabled in order to provide feedback to the user that they cannot take input.
  Overrides:
    `setEnabled` in class `Component`
  See Also:
    `Component.isEnabled()`

### setForeground

    public void setForeground(Color fg)

  Sets the foreground color of this component.
  Overrides:
    `setForeground` in class `Component`
  See Also:
    `Component.getForeground()`

### setBackground

    public void setBackground(Color bg)

  Sets the background color of this component.
  Overrides:
    `setBackground` in class `Component`
  See Also:
    `Component.getBackground()`

### setFont

    public void setFont(Font font)

  Sets the font for this component.
  Overrides:
    `setFont` in class `Container`
  See Also:
    `Component.getFont()`

### isFocusTraversable

    public boolean isFocusTraversable()

  Identifies whether or not this component can receive the focus. A disabled button, for example, would return false.
  Overrides:
    `isFocusTraversable` in class `Component`
  Returns:
    true if this component can receive the focus

### processFocusEvent

    protected void processFocusEvent(FocusEvent e)

  Description copied from class: `Component`
  Processes focus events occurring on this component by dispatching them to any registered `FocusListener` objects.

  This method is not called unless focus events are enabled for this component. Focus events are enabled when one of the following occurs:

  - A `FocusListener` object is registered via `addFocusListener`.
  - Focus events are enabled via `enableEvents`.
  Overrides:
    `processFocusEvent` in class `Component`
  Following copied from class: `java.awt.Component`
  Parameters:
    `e` - the focus event.
  See Also:
    `FocusEvent`, `FocusListener`, `Component.addFocusListener(java.awt.event.FocusListener)`, `Component.enableEvents(long)`

### processComponentKeyEvent

    protected void processComponentKeyEvent(KeyEvent e)

  Processes any key events that the component itself recognizes. This is called after the focus manager and any interested listeners have been given a chance to steal away the event. This method is called only if the event has not yet been consumed. This method is called prior to the keyboard UI logic.

  This method is implemented to do nothing. Subclasses would normally override this method if they process some key events themselves. If the event is processed, it should be consumed.

### processKeyEvent

    protected void processKeyEvent(KeyEvent e)

  Overrides processKeyEvent to process events.
  Overrides:
    `processKeyEvent` in class `Component`
  Following copied from class: `java.awt.Component`
  Parameters:
    `e` - the key event.
  See Also:
    `KeyEvent`, `KeyListener`, `Component.addKeyListener(java.awt.event.KeyListener)`, `Component.enableEvents(long)`

### processKeyBinding

    protected boolean processKeyBinding(KeyStroke ks,
                                        KeyEvent e,
                                        int condition,
                                        boolean pressed)

  Invoked to process the key bindings for `ks` as the result of the KeyEvent `e`. This obtains the appropriate InputMap, gets the binding, gets the action from the ActionMap, and then (if the action is found and the receiver is enabled) invokes notifyAction to notify the action.
  Returns:
    true if there was a binding to an action, and the action was enabled
  Since:
    1.3

### setToolTipText

    public void setToolTipText(String text)

  Registers the text to display in a tool tip. The text displays when the cursor lingers over the component.

  See How to Use Tool Tips in The Java Tutorial for further documentation.

  Parameters:
    `text` - the string to display; if the text is null, the tool tip is turned off for this component
  See Also:
    `TOOL_TIP_TEXT_KEY`

### getToolTipText

    public String getToolTipText()

  Returns the tooltip string that has been set with setToolTipText().
  Returns:
    the text of the tool tip
  See Also:
    `TOOL_TIP_TEXT_KEY`

### getToolTipText

    public String getToolTipText(MouseEvent event)

  Returns the string to be used as the tooltip for event. By default this returns any string set using setToolTipText(). If a component provides more extensive API to support differing tooltips at different locations, this method should be overridden.

### getToolTipLocation

    public Point getToolTipLocation(MouseEvent event)

  Returns the tooltip location in this component's coordinate system. If null is returned, Swing will choose a location. The default implementation returns null.
  Parameters:
    `event` - the MouseEvent that caused the ToolTipManager to show the tooltip

### createToolTip

    public JToolTip createToolTip()

  Returns the instance of JToolTip that should be used to display the tooltip. Components typically would not override this method, but it can be used to cause different tooltips to be displayed differently.

### scrollRectToVisible

    public void scrollRectToVisible(Rectangle aRect)

  Forwards the scrollRectToVisible() message to the JComponent's parent. Components that can service the request, such as JViewport, override this method and perform the scrolling.
  See Also:
    `JViewport`

### setAutoscrolls

    public void setAutoscrolls(boolean autoscrolls)

  If true this component will automatically scroll its contents when dragged, if contained in a component that supports scrolling, such as JViewport.
  See Also:
    `JViewport`, `getAutoscrolls()`

### getAutoscrolls

    public boolean getAutoscrolls()

  Returns true if this component automatically scrolls its contents when dragged (when contained in a component that supports scrolling, like JViewport).
  See Also:
    `JViewport`, `setAutoscrolls(boolean)`

### processMouseMotionEvent

    protected void processMouseMotionEvent(MouseEvent e)

  Description copied from class: `Component`
  Processes mouse motion events occurring on this component by dispatching them to any registered `MouseMotionListener` objects.

  This method is not called unless mouse motion events are enabled for this component. Mouse motion events are enabled when one of the following occurs:

  - A `MouseMotionListener` object is registered via `addMouseMotionListener`.
  - Mouse motion events are enabled via `enableEvents`.
  Overrides:
    `processMouseMotionEvent` in class `Component`
  Following copied from class: `java.awt.Component`
  Parameters:
    `e` - the mouse motion event.
  See Also:
    `java.awt.event.MouseMotionEvent`, `MouseMotionListener`, `Component.addMouseMotionListener(java.awt.event.MouseMotionListener)`, `Component.enableEvents(long)`

### enable

    public void enable()

  overridden to ensure Accessibility support
  Overrides:
    `enable` in class `Component`

### disable

    public void disable()

  overridden to ensure Accessibility support
  Overrides:
    `disable` in class `Component`

### getAccessibleContext

    public AccessibleContext getAccessibleContext()

  Gets the AccessibleContext associated with this JComponent.
  Overrides:
    `getAccessibleContext` in class `Component`
  Returns:
    the AccessibleContext of this JComponent

### getClientProperty

    public final Object getClientProperty(Object key)

  Returns the value of the property with the specified key. Only properties added with `putClientProperty` will return a non-null value.
  Returns:
    the value of this property or null
  See Also:
    `putClientProperty(java.lang.Object, java.lang.Object)`

### putClientProperty

    public final void putClientProperty(Object key,
                                        Object value)

  Adds an arbitrary key/value "client property" to this component.

  The `get/putClientProperty` methods provide access to a small per-instance hashtable. Callers can use get/putClientProperty to annotate components that were created by another module. For example, a layout manager might store per child constraints this way. For example:

       componentA.putClientProperty("to the left of", componentB);

  If value is null this method will remove the property. Changes to client properties are reported with PropertyChange events. The name of the property (for the sake of PropertyChange events) is `key.toString()`.

  The clientProperty dictionary is not intended to support large scale extensions to JComponent nor should be it considered an alternative to subclassing when designing a new component.

  See Also:
    `getClientProperty(java.lang.Object)`, `addPropertyChangeListener(java.beans.PropertyChangeListener)`

### isLightweightComponent

    public static boolean isLightweightComponent(Component c)

  Returns true if this component is a lightweight, that is, if it doesn't have a native window system peer.
  Returns:
    true if this component is a lightweight

### reshape

    public void reshape(int x,
                        int y,
                        int w,
                        int h)

  Moves and resizes this component.
  Overrides:
    `reshape` in class `Component`
  See Also:
    `Component.setBounds(int, int, int, int)`

### getBounds

    public Rectangle getBounds(Rectangle rv)

  Stores the bounds of this component into "return value" rv and returns rv. If rv is null a new Rectangle is allocated. This version of getBounds() is useful if the caller wants to avoid allocating a new Rectangle object on the heap.
  Overrides:
    `getBounds` in class `Component`
  Parameters:
    `rv` - the return value, modified to the component's bounds
  Returns:
    rv

### getSize

    public Dimension getSize(Dimension rv)

  Stores the width/height of this component into "return value" rv and returns rv. If rv is null a new Dimension object is allocated. This version of getSize() is useful if the caller wants to avoid allocating a new Dimension object on the heap.
  Overrides:
    `getSize` in class `Component`
  Parameters:
    `rv` - the return value, modified to the component's size
  Returns:
    rv

### getLocation

    public Point getLocation(Point rv)

  Stores the x,y origin of this component into "return value" rv and returns rv. If rv is null a new Point is allocated. This version of getLocation() is useful if the caller wants to avoid allocating a new Point object on the heap.
  Overrides:
    `getLocation` in class `Component`
  Parameters:
    `rv` - the return value, modified to the component's location
  Returns:
    rv

### getX

    public int getX()

  Returns the current x coordinate of the component's origin. This method is preferable to writing component.getBounds().x, or component.getLocation().x because it doesn't cause any heap allocations.
  Overrides:
    `getX` in class `Component`
  Returns:
    the current x coordinate of the component's origin

### getY

    public int getY()

  Returns the current y coordinate of the component's origin. This method is preferable to writing component.getBounds().y, or component.getLocation().y because it doesn't cause any heap allocations.
  Overrides:
    `getY` in class `Component`
  Returns:
    the current y coordinate of the component's origin

### getWidth

    public int getWidth()

  Returns the current width of this component. This method is preferable to writing component.getBounds().width, or component.getSize().width because it doesn't cause any heap allocations.
  Overrides:
    `getWidth` in class `Component`
  Returns:
    the current width of this component.

### getHeight

    public int getHeight()

  Returns the current height of this component. This method is preferable to writing component.getBounds().height, or component.getSize().height because it doesn't cause any heap allocations.
  Overrides:
    `getHeight` in class `Component`
  Returns:
    the current height of this component.

### hasFocus

    public boolean hasFocus()

  Returns true if this Component has the keyboard focus.
  Overrides:
    `hasFocus` in class `Component`
  Returns:
    true if this Component has the keyboard focus.

### isOpaque

    public boolean isOpaque()

  Returns true if this component is completely opaque.

  An opaque component paints every pixel within its rectangular bounds. A non-opaque component paints only a subset of its pixels or none at all, allowing the pixels underneath it to "show through". Therefore, a component that does not fully paint its pixels provides a degree of transparency.

  Subclasses that guarantee to always completely paint their contents should override this method and return true.

  Overrides:
    `isOpaque` in class `Component`
  Returns:
    true if this component is completely opaque
  See Also:
    `setOpaque(boolean)`

### setOpaque

    public void setOpaque(boolean isOpaque)

  If true the component paints every pixel within its bounds. Otherwise, the component may not paint some or all of its pixels, allowing the underlying pixels to show through.

  The default value of this property is false for `JComponent`. However, the default value for this property on most standard `JComponent` subclasses (such as `JButton` and `JTree`) is look-and-feel dependent.

  See Also:
    `isOpaque()`

### computeVisibleRect

    public void computeVisibleRect(Rectangle visibleRect)

  Returns the Component's "visible rect rectangle" - the intersection of the visible rectangles for this component and all of its ancestors. The return value is stored in `visibleRect`.
  See Also:
    `getVisibleRect()`

### getVisibleRect

    public Rectangle getVisibleRect()

  Returns the Component's "visible rectangle" - the intersection of this component's visible rectangle:

       new Rectangle(0, 0, getWidth(), getHeight());

  and all of its ancestors' visible Rectangles.
  Returns:
    the visible rectangle

### firePropertyChange

    protected void firePropertyChange(String propertyName,
                                      Object oldValue,
                                      Object newValue)

  Supports reporting bound property changes. If oldValue and newValue are not equal and the PropertyChangeEvent listener list isn't empty, then fire a PropertyChange event to each listener. This method has an overloaded method for each primitive type. For example, here's how to write a bound property set method whose value is an int:

       public void setFoo(int newValue) {
           int oldValue = foo;
           foo = newValue;
           firePropertyChange("foo", oldValue, newValue);
       }

  Overrides:
    `firePropertyChange` in class `Component`
  Parameters:
    `propertyName` - the programmatic name of the property that was changed
    `oldValue` - the old value of the property
    `newValue` - the new value of the property
  See Also:
    `PropertyChangeSupport`

### firePropertyChange

    public void firePropertyChange(String propertyName,
                                   byte oldValue,
                                   byte newValue)

  Reports a bound property change.
  See Also:
    `firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)`

### firePropertyChange

    public void firePropertyChange(String propertyName,
                                   char oldValue,
                                   char newValue)

  Reports a bound property change.
  See Also:
    `firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)`

### firePropertyChange

    public void firePropertyChange(String propertyName,
                                   short oldValue,
                                   short newValue)

  Reports a bound property change.
  See Also:
    `firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)`

### firePropertyChange

    public void firePropertyChange(String propertyName,
                                   int oldValue,
                                   int newValue)

  Reports a bound property change.
  See Also:
    `firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)`

### firePropertyChange

    public void firePropertyChange(String propertyName,
                                   long oldValue,
                                   long newValue)

  Reports a bound property change.
  See Also:
    `firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)`

### firePropertyChange

    public void firePropertyChange(String propertyName,
                                   float oldValue,
                                   float newValue)

  Reports a bound property change.
  See Also:
    `firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)`

### firePropertyChange

    public void firePropertyChange(String propertyName,
                                   double oldValue,
                                   double newValue)

  Reports a bound property change.
  See Also:
    `firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)`

### firePropertyChange

    public void firePropertyChange(String propertyName,
                                   boolean oldValue,
                                   boolean newValue)

  Reports a bound property change.
  See Also:
    `firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)`

### addPropertyChangeListener

    public void addPropertyChangeListener(PropertyChangeListener listener)

  Adds a PropertyChangeListener to the listener list. The listener is registered for all properties.

  A PropertyChangeEvent will get fired in response to setting a bound property, such as setFont, setBackground, or setForeground. Note that if the current component is inheriting its foreground, background, or font from its container, then no event will be fired in response to a change in the inherited property.

  Overrides:
    `addPropertyChangeListener` in class `Component`
  Parameters:
    `listener` - the PropertyChangeListener to be added

### addPropertyChangeListener

    public void addPropertyChangeListener(String propertyName,
                                          PropertyChangeListener listener)

  Adds a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property. If listener is null, no exception is thrown and no action is performed.
  Overrides:
    `addPropertyChangeListener` in class `Component`
  Parameters:
    `propertyName` - the name of the property to listen on
    `listener` - the PropertyChangeListener to be added

### removePropertyChangeListener

    public void removePropertyChangeListener(PropertyChangeListener listener)

  Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.
  Overrides:
    `removePropertyChangeListener` in class `Component`
  Parameters:
    `listener` - the PropertyChangeListener to be removed

### removePropertyChangeListener

    public void removePropertyChangeListener(String propertyName,
                                             PropertyChangeListener listener)

  Removes a PropertyChangeListener for a specific property. If listener is null, no exception is thrown and no action is performed.
  Overrides:
    `removePropertyChangeListener` in class `Component`
  Parameters:
    `propertyName` - the name of the property that was listened on
    `listener` - the PropertyChangeListener to be removed

### fireVetoableChange

    protected void fireVetoableChange(String propertyName,
                                      Object oldValue,
                                      Object newValue)
                               throws PropertyVetoException

  Supports reporting constrained property changes. This method can be called when a constrained property has changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners.
  Throws:
    `PropertyVetoException` - when the attempt to set the property is vetoed by the receiver.

### addVetoableChangeListener

    public void addVetoableChangeListener(VetoableChangeListener listener)

  Adds a VetoableChangeListener to the listener list. The listener is registered for all properties.
  Parameters:
    `listener` - the VetoableChangeListener to be added

### removeVetoableChangeListener

    public void removeVetoableChangeListener(VetoableChangeListener listener)

  Removes a VetoableChangeListener from the listener list. This removes a VetoableChangeListener that was registered for all properties.
  Parameters:
    `listener` - the VetoableChangeListener to be removed

### getTopLevelAncestor

    public Container getTopLevelAncestor()

  Returns the top-level ancestor of this component (either the containing Window or Applet), or null if this component has not been added to any container.
  Returns:
    the top-level Container that this component is in

### addAncestorListener

    public void addAncestorListener(AncestorListener listener)

  Registers listener so that it will receive AncestorEvents when it or any of its ancestors move or are made visible / invisible. Events are also sent when the component or its ancestors are added or removed from the containment hierarchy.
  See Also:
    `AncestorEvent`

### removeAncestorListener

    public void removeAncestorListener(AncestorListener listener)

  Unregisters listener so that it will no longer receive AncestorEvents
  See Also:
    `addAncestorListener(javax.swing.event.AncestorListener)`

### getListeners

    public EventListener[] getListeners(Class listenerType)

  Return an array of all the listeners that were added to this JComponent with addXXXListener(), where XXX is the name of the `listenerType` argument. For example, to get all of the MouseListeners for the given Component `c`, one would write:

       MouseListener[] mls = (MouseListener[])(c.getListeners(MouseListener.class))

  If no such listener list exists, then an empty array is returned.
  Overrides:
    `getListeners` in class `Container`
  Since:
    1.3

### addNotify

    public void addNotify()

  Notifies this component that it now has a parent component. When this method is invoked, the chain of parent components is set up with KeyboardAction event listeners.
  Overrides:
    `addNotify` in class `Container`
  See Also:
    `registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)`

### removeNotify

    public void removeNotify()

  Notifies this component that it no longer has a parent component. When this method is invoked, any KeyboardActions set up in the the chain of parent components are removed.
  Overrides:
    `removeNotify` in class `Container`
  See Also:
    `registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)`

### repaint

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

  Adds the specified region to the dirty region list if the component is showing. The component will be repainted after all of the currently pending events have been dispatched.
  Overrides:
    `repaint` in class `Component`
  See Also:
    `Component.isShowing()`, `RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)`

### repaint

    public void repaint(Rectangle r)

  Adds the specified region to the dirty region list if the component is showing. The component will be repainted after all of the currently pending events have been dispatched.
  See Also:
    `Component.isShowing()`, `RepaintManager.addDirtyRegion(javax.swing.JComponent, int, int, int, int)`

### revalidate

    public void revalidate()

  Supports deferred automatic layout.

  Calls invalidate() and then adds this component's validateRoot to a list of components that need to be validated. Validation will occur after all currently pending events have been dispatched. In other words after this method is called, the first validateRoot (if any) found when walking up the containment hierarchy of this component will be validated. By default, `JRootPane`, `JScrollPane`, and `JTextField` return true from `isValidateRoot`.

  This method will automatically be called on this component when a property value changes such that size, location, or internal layout of this component has been affected. This automatic updating differs from the AWT because programs generally no longer need to invoke validate() to get the contents of the GUI to update.

  See Also:
    `Component.invalidate()`, `Container.validate()`, `isValidateRoot()`, `RepaintManager.addInvalidComponent(javax.swing.JComponent)`

### isValidateRoot

    public boolean isValidateRoot()

  If this method returns true, revalidate() calls by descendants of this component will cause the entire tree beginning with this root to be validated. Returns false by default. JScrollPane overrides this method and returns true.
  Returns:
    false
  See Also:
    `revalidate()`, `Component.invalidate()`, `Container.validate()`

### isOptimizedDrawingEnabled

    public boolean isOptimizedDrawingEnabled()

  Returns true if this component tiles its children -- that is, if it can guarantee that the children will not overlap. The repainting system is substantially more efficient in this common case. JComponent subclasses that can't make this guarantee, such as JLayeredPane, should override this method to return false.
  Returns:
    true if this component's children don't overlap

### paintImmediately

    public void paintImmediately(int x,
                                 int y,
                                 int w,
                                 int h)

  Paints the specified region in this component and all of its descendants that overlap the region, immediately.

  It's rarely necessary to call this method. In most cases it's more efficient to call repaint, which defers the actual painting and can collapse redundant requests into a single paint call. This method is useful if one needs to update the display while the current event is being dispatched.

  See Also:
    `repaint(long, int, int, int, int)`

### paintImmediately

    public void paintImmediately(Rectangle r)

  Paints the specified region now.

### setDoubleBuffered

    public void setDoubleBuffered(boolean aFlag)

  Sets whether the receiving component should use a buffer to paint. If set to true, all the drawing from this component will be done in an offscreen painting buffer. The offscreen painting buffer will the be copied onto the screen. Swing's painting system always use a maximum of one double buffer. If a Component is buffered and one of its ancestor is also buffered, the ancestor buffer will be used.

### isDoubleBuffered

    public boolean isDoubleBuffered()

  Returns whether the receiving component should use a buffer to paint.
  Overrides:
    `isDoubleBuffered` in class `Component`
  Following copied from class: `java.awt.Component`
  Returns:
    false by default

### getRootPane

    public JRootPane getRootPane()

  Returns the JRootPane ancestor for a component
  Returns:
    the JRootPane that contains this component, or null if no JRootPane is found

### paramString

    protected String paramString()

  Returns a string representation of this JComponent. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be `null`.
  Overrides:
    `paramString` in class `Container`
  Returns:
    a string representation of this JComponent

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.