All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JComponent

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

public class JComponent
extends Container
JComponent


Variable Index

 o jMouseListener
 o jMouseMotionListener
 o PARENT_PROPERTY
 o propertyTable
 o TOOL_TIP_TEXT_KEY
 o ui
 o UNDEFINED_CONDITION
Constand used by some of the apis to mean that no condition is defined
 o WHEN_FOCUSED
Constant used for registerKeyboardAction().
 o WHEN_FOCUSED_COMPONENT_PARENT
Constant used for registerKeyboardAction().
 o WHEN_IN_FOCUSED_WINDOW
Constant used for registerKeyboardAction().

Constructor Index

 o JComponent()
 o JComponent(LayoutManager2)

Method Index

 o addAncestorListener(AncestorListener)
Registers listener so that it will receive AncestorEvents when it or any of its ancestors move or are made visible / invisible.
 o addNotify()
 o addPropertyChangeListener(PropertyChangeListener)
Add a PropertyChangeListener to the listener list.
 o addVetoableChangeListener(VetoableChangeListener)
Add a VetoableChangeListener to the listener list.
 o computeVisibleRect(Rectangle)
Computes the Component's "visible rect," the intersection of the View's and all of its ancestors' bounding rectangles, placing it in visibleRect.
 o createToolTip()
Returns the instance of JToolTip that should be used to display the tooltip.
 o firePropertyChange(String, Object, Object)
Support for reporting bound property changes.
 o fireVetoableChange(String, Object, Object)
Support for reporting constrained property changes.
 o getActionForKeyStroke(JKeyStroke)
Return the action registered with an action
 o getAlignmentX()
 o getAlignmentY()
 o getAppropriateGraphics(Graphics)
 o getAutoscrolls()
 o getBounds(Rectangle)
Store the receiving JComponent bounds into dest and return dest.
 o getConditionForKeyStroke(JKeyStroke)
Return the condition registered with an action
 o getDebugGraphicsOptions()
Returns the state of graphics debugging.
 o getGraphics()
 o getHeight()
 o getInsets()
 o getLocation(Point)
Store the receiving JComponent location into dest and return dest
 o getMaximumSize()
 o getMinimumSize()
 o getParentWindow()
Returns the top-level window which this component is in.
 o getPreferredSize()
 o getProperty(Object)
Support for a small table of per object "properties".
 o getRegisteredKeyStrokes()
Return the KeyStroke that will perform an action
 o getSize(Dimension)
Store the receiving JComponent dimension into dest and return dest
 o getToolTipText(MouseEvent)
Returns the string to be used as the tooltip for event.
 o getVisibleRect()
Returns the Component's "visible rect," the intersection of the View's and all of its ancestors' bounding rectangles
 o getWidth()
 o getX()
 o getY()
 o hasFocus()
Returns true if this Container has the keyboard focus.
 o isFocusTraversable()
 o isOpaque()
 o paint(Graphics)
 o paintImmediately(int, int, int, int)
Cause the receiving JComponent to redraw the specified rectangle immediately.
 o paintImmediately(Rectangle)
 o processKeyEvent(KeyEvent)
Override processKeyEvent to process events
 o processMouseMotionEvent(MouseEvent)
 o putProperty(Object, Object)
 o registerKeyboardAction(ActionListener, JKeyStroke, int)
Register a new keyboard action.
 o removeAncestorListener(AncestorListener)
Unregisters listener so that it will no longer receive AncestorEvents
 o removeNotify()
 o removePropertyChangeListener(PropertyChangeListener)
Remove a PropertyChangeListener from the listener list.
 o removeVetoableChangeListener(VetoableChangeListener)
Remove a VetoableChangeListener from the listener list.
 o repaint(long, int, int, int, int)
 o repaint(Rectangle)
 o requestDefaultFocus()
Request the focus for the component that should have the focus by default.
 o resetKeyboardActions()
Unregister all keyboard actions
 o scrollRectToVisible(Rectangle)
Forwards the scrollRectToVisible() message to the JComponent's parent.
 o setAlignmentX(float)
 o setAlignmentY(float)
 o setAutoscrolls(boolean)
If true this component will automatically scroll it contents when dragged, if contained in a component that supports scrolling, such as JViewport
 o setBounds(int, int, int, int)
 o setDebugGraphicsOptions(int)
Enables or disables diagnostic information about every graphics operation performed within the JComponent or one of its children.
 o setInsets(Insets)
 o setMaximumSize(Dimension)
 o setMinimumSize(Dimension)
 o setPreferredSize(Dimension)
 o setToolTipText(String)
Registers text as the string to be displayed in a ToolTip.
 o setUI(ComponentUI)
 o unregisterKeyboardAction(JKeyStroke)
Unregister a keyboard action
 o updateUI()
Notification from the UIFactory that the L&F has changed.

Variables

 o ui
 protected ComponentUI ui
 o propertyTable
 protected Object propertyTable[]
 o jMouseMotionListener
 protected MouseEventMulticaster jMouseMotionListener
 o jMouseListener
 protected MouseEventMulticaster jMouseListener
 o WHEN_FOCUSED
 public static final int WHEN_FOCUSED
Constant used for registerKeyboardAction(). WHEN_FOCUS means that the command should be invoked when the component has the focus

 o WHEN_FOCUSED_COMPONENT_PARENT
 public static final int WHEN_FOCUSED_COMPONENT_PARENT
Constant used for registerKeyboardAction(). WHEN_FOCUSED_COMPONENT_PARENT means that the comand should be invoked when the component is the parent of the focused component or is the focused component.

 o WHEN_IN_FOCUSED_WINDOW
 public static final int WHEN_IN_FOCUSED_WINDOW
Constant used for registerKeyboardAction(). WHEN_IN_MAIN_WINDOW means that the command should be invoked when the component is in the focused component's window.

 o UNDEFINED_CONDITION
 public static final int UNDEFINED_CONDITION
Constand used by some of the apis to mean that no condition is defined

 o TOOL_TIP_TEXT_KEY
 public static final String TOOL_TIP_TEXT_KEY
 o PARENT_PROPERTY
 public static final String PARENT_PROPERTY

Constructors

 o JComponent
 public JComponent()
 o JComponent
 public JComponent(LayoutManager2 layout)

Methods

 o getProperty
 public Object getProperty(Object key)
Support for a small table of per object "properties".

 o putProperty
 public void putProperty(Object key,
                         Object value)
 o getX
 public int getX()
 o getY
 public int getY()
 o getWidth
 public int getWidth()
 o getHeight
 public int getHeight()
 o hasFocus
 public boolean hasFocus()
Returns true if this Container has the keyboard focus.

 o updateUI
 public void updateUI()
Notification from the UIFactory that the L&F has changed. An example implementation of this for JButton might be:
   public void updateUI() {
      setUI((ButtonUI)UIManager.getUI(
          "ButtonUI", "com.sun.java.swing.basic.BasicButton", this));
      invalidate();
   }
  

 o setUI
 protected void setUI(ComponentUI x)
 o getAppropriateGraphics
 protected Graphics getAppropriateGraphics(Graphics g)
 o paint
 public void paint(Graphics g)
Overrides:
paint in class Container
 o isOpaque
 public boolean isOpaque()
 o setPreferredSize
 public void setPreferredSize(Dimension preferredSize)
 o getPreferredSize
 public Dimension getPreferredSize()
Overrides:
getPreferredSize in class Container
 o setMaximumSize
 public void setMaximumSize(Dimension maxSize)
 o getMaximumSize
 public Dimension getMaximumSize()
Overrides:
getMaximumSize in class Container
 o setMinimumSize
 public void setMinimumSize(Dimension minSize)
 o getMinimumSize
 public Dimension getMinimumSize()
Overrides:
getMinimumSize in class Container
 o getInsets
 public Insets getInsets()
Overrides:
getInsets in class Container
 o setInsets
 public void setInsets(Insets i)
 o getAlignmentY
 public float getAlignmentY()
Overrides:
getAlignmentY in class Container
 o setAlignmentY
 public void setAlignmentY(float alignY)
 o getAlignmentX
 public float getAlignmentX()
Overrides:
getAlignmentX in class Container
 o setAlignmentX
 public void setAlignmentX(float alignX)
 o getGraphics
 public Graphics getGraphics()
Overrides:
getGraphics in class Component
 o repaint
 public void repaint(long tm,
                     int x,
                     int y,
                     int width,
                     int height)
Overrides:
repaint in class Component
 o repaint
 public void repaint(Rectangle r)
 o paintImmediately
 public void paintImmediately(int x,
                              int y,
                              int w,
                              int h)
Cause the receiving JComponent to redraw the specified rectangle immediately.

 o paintImmediately
 public void paintImmediately(Rectangle r)
 o setDebugGraphicsOptions
 public void setDebugGraphicsOptions(int debugOptions)
Enables or disables diagnostic information about every graphics operation performed within the JComponent or one of its children. The value of debugOptions determines how the JComponent should display this information: 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.

 o getDebugGraphicsOptions
 public int getDebugGraphicsOptions()
Returns the state of graphics debugging.

See Also:
setDebugGraphicsOptions
 o registerKeyboardAction
 public void registerKeyboardAction(ActionListener anAction,
                                    JKeyStroke aKeyStroke,
                                    int aCondition)
Register a new keyboard action. anAction will be invoked if a key event matching aKeyStroke occurs and aCondition is verified. aCondition can currently be: If an action has already been registered for the receiving container, with the same charCode and the same modifiers, anAction will replace the action.

 o unregisterKeyboardAction
 public void unregisterKeyboardAction(JKeyStroke aKeyStroke)
Unregister a keyboard action

 o getRegisteredKeyStrokes
 public JKeyStroke[] getRegisteredKeyStrokes()
Return the KeyStroke that will perform an action

 o getConditionForKeyStroke
 public int getConditionForKeyStroke(JKeyStroke aKeyStroke)
Return the condition registered with an action

 o getActionForKeyStroke
 public ActionListener getActionForKeyStroke(JKeyStroke aKeyStroke)
Return the action registered with an action

 o resetKeyboardActions
 public void resetKeyboardActions()
Unregister all keyboard actions

 o requestDefaultFocus
 public boolean requestDefaultFocus()
Request the focus for the component that should have the focus by default. The default implementation will request the focus one the first component that is focus traversable. Return false if the focus has not been set Return true otherwise.

 o isFocusTraversable
 public boolean isFocusTraversable()
Overrides:
isFocusTraversable in class Component
 o processKeyEvent
 protected void processKeyEvent(KeyEvent e)
Override processKeyEvent to process events

Overrides:
processKeyEvent in class Component
 o setToolTipText
 public void setToolTipText(String text)
Registers text as the string to be displayed in a ToolTip.

 o 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 extensize API to support differing tooltips at different locations, this method should be overridden.

 o 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.

 o getParentWindow
 public Window getParentWindow()
Returns the top-level window which this component is in.

Returns:
the top-level window, or null if this component has not been added to any window.
 o computeVisibleRect
 public void computeVisibleRect(Rectangle visibleRect)
Computes the Component's "visible rect," the intersection of the View's and all of its ancestors' bounding rectangles, placing it in visibleRect.

 o getVisibleRect
 public Rectangle getVisibleRect()
Returns the Component's "visible rect," the intersection of the View's and all of its ancestors' bounding rectangles

 o scrollRectToVisible
 public void scrollRectToVisible(Rectangle aRect)
Forwards the scrollRectToVisible() message to the JComponent's parent. Components that can service the request, such as a JViewport, override this method and perform the scrolling.

See Also:
JViewport
 o setAutoscrolls
 public void setAutoscrolls(boolean autoscrolls)
If true this component will automatically scroll it contents when dragged, if contained in a component that supports scrolling, such as JViewport

See Also:
JViewport, getAutoscrolls
 o getAutoscrolls
 public boolean getAutoscrolls()
 o processMouseMotionEvent
 protected void processMouseMotionEvent(MouseEvent e)
Overrides:
processMouseMotionEvent in class Component
 o firePropertyChange
 protected void firePropertyChange(String propertyName,
                                   Object oldValue,
                                   Object newValue)
Support for reporting bound property changes. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

 o addPropertyChangeListener
 public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired in response to an explicit setFont, setBackground, or SetForeground on the current component. 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.

Parameters:
listener - The PropertyChangeListener to be added
 o removePropertyChangeListener
 public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - The PropertyChangeListener to be removed
 o fireVetoableChange
 protected void fireVetoableChange(String propertyName,
                                   Object oldValue,
                                   Object newValue) throws PropertyVetoException
Support for 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.

 o addVetoableChangeListener
 public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Add a VetoableChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired in response to an explicit setFont, setBackground, or SetForeground on the current component. 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.

Parameters:
listener - The VetoableChangeListener to be added
 o removeVetoableChangeListener
 public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Remove a VetoableChangeListener from the listener list. This removes a VetoableChangeListener that was registered for all properties.

Parameters:
listener - The VetoableChangeListener to be removed
 o addNotify
 public void addNotify()
Overrides:
addNotify in class Container
 o removeNotify
 public void removeNotify()
Overrides:
removeNotify in class Container
 o 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 Component hierarchy

See Also:
AncestorEvent
 o removeAncestorListener
 public void removeAncestorListener(AncestorListener listener)
Unregisters listener so that it will no longer receive AncestorEvents

See Also:
addAncestorListener
 o setBounds
 public void setBounds(int x,
                       int y,
                       int w,
                       int h)
Overrides:
setBounds in class Component
 o getBounds
 public Rectangle getBounds(Rectangle dest)
Store the receiving JComponent bounds into dest and return dest. no new Rectangle is allocated.

 o getSize
 public Dimension getSize(Dimension dest)
Store the receiving JComponent dimension into dest and return dest

 o getLocation
 public Point getLocation(Point dest)
Store the receiving JComponent location into dest and return dest


All Packages  Class Hierarchy  This Package  Previous  Next  Index