Public Methods of the JComponent Class
  • void addNotify() Notification to this component that it now has a parent component.
  • 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) Give 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 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.
  • void firePropertyChange(String propertyName, short oldValue, short newValue) Reports a bound property change.
  • ActionListener getActionForKeyStroke(KeyStroke aKeyStroke) Return the object that will perform the action registered for a given keystroke.
  • Rectangle getBounds(Rectangle rv)  Store the bounds of this component into "return value" rv and return rv.
  • Object getClientProperty(Object key) Returns the value of the property with the specified key.
  • int getConditionForKeyStroke(KeyStroke aKeyStroke) Return the condition that determines whether a registered action occurs in response to the specified keystroke.
  • Insets getInsets(Insets insets)  Returns an Insets object containing this component's inset values.
  • Point getLocation(Point rv)  Store the x,y origin of this component into "return value" rv and return rv.
  • Dimension getSize(Dimension rv)  Store the width/height of this component into "return value" rv and return rv.
  • Point getToolTipLocation(MouseEvent event) Return the tooltip location in the receiving component coordinate system If null is returned, Swing will choose a location.
  • String getToolTipText(MouseEvent event) Returns the string to be used as the tooltip for event.
  • void grabFocus() Set the focus on the receiving component.
  • boolean hasFocus() Returns true if this Component has the keyboard focus.
  • static boolean isLightweightComponent(Component c) Returns true if this component is a lightweight, i.e.
  • void paintImmediately(int x, int y, int w, int h) Paint the specified region in this component and all of its descendants that overlap the region, immediately.
  • void paintImmediately(Rectangle r) Paint the specified region now.
  • void putClientProperty(Object key, Object value) Add an arbitrary key/value "client property" to this component.
  • void registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)  Calls registerKeyboardAction(ActionListener,String, KeyStroke, condition) with a null command.
  • void registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition) Register a new keyboard action.
  • void removeNotify() Notification to this component that it no longer has a parent component.
  • 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() Request the focus for the component that should have the focus by default.
  • void requestFocus() Set focus on the receiving component if isRequestFocusEnabled returns true
  • void resetKeyboardActions() Unregister all keyboard actions
  • void reshape(int x, int y, int w, int h) Moves and resizes this component.
  • void revalidate() Support for deferred automatic layout.
  • void scrollRectToVisible(Rectangle aRect) Forwards the scrollRectToVisible() message to the JComponent's parent.
  • void unregisterKeyboardAction(KeyStroke aKeyStroke) Unregister a keyboard action.
  • void update(Graphics g) Calls paint(g).
  • void updateUI() Resets the UI property to a value from the current look and feel.


Figure 5