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
-
jMouseListener
-
-
jMouseMotionListener
-
-
PARENT_PROPERTY
-
-
propertyTable
-
-
TOOL_TIP_TEXT_KEY
-
-
ui
-
-
UNDEFINED_CONDITION
- Constand used by some of the apis to mean that no condition is defined
-
WHEN_FOCUSED
- Constant used for registerKeyboardAction().
-
WHEN_FOCUSED_COMPONENT_PARENT
- Constant used for registerKeyboardAction().
-
WHEN_IN_FOCUSED_WINDOW
- Constant used for registerKeyboardAction().
-
JComponent()
-
-
JComponent(LayoutManager2)
-
-
addAncestorListener(AncestorListener)
- Registers listener so that it will receive AncestorEvents
when it or any of its ancestors move or are made visible / invisible.
-
addNotify()
-
-
addPropertyChangeListener(PropertyChangeListener)
- Add a PropertyChangeListener to the listener list.
-
addVetoableChangeListener(VetoableChangeListener)
- Add a VetoableChangeListener to the listener list.
-
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.
-
createToolTip()
- Returns the instance of JToolTip that should be used to display the tooltip.
-
firePropertyChange(String, Object, Object)
- Support for reporting bound property changes.
-
fireVetoableChange(String, Object, Object)
- Support for reporting constrained property changes.
-
getActionForKeyStroke(JKeyStroke)
- Return the action registered with an action
-
getAlignmentX()
-
-
getAlignmentY()
-
-
getAppropriateGraphics(Graphics)
-
-
getAutoscrolls()
-
-
getBounds(Rectangle)
- Store the receiving JComponent bounds into dest and return dest.
-
getConditionForKeyStroke(JKeyStroke)
- Return the condition registered with an action
-
getDebugGraphicsOptions()
- Returns the state of graphics debugging.
-
getGraphics()
-
-
getHeight()
-
-
getInsets()
-
-
getLocation(Point)
- Store the receiving JComponent location into dest and return dest
-
getMaximumSize()
-
-
getMinimumSize()
-
-
getParentWindow()
- Returns the top-level window which this component is in.
-
getPreferredSize()
-
-
getProperty(Object)
- Support for a small table of per object "properties".
-
getRegisteredKeyStrokes()
- Return the KeyStroke that will perform an action
-
getSize(Dimension)
- Store the receiving JComponent dimension into dest and return dest
-
getToolTipText(MouseEvent)
- Returns the string to be used as the tooltip for event.
-
getVisibleRect()
- Returns the Component's "visible rect," the intersection
of the View's and all of its ancestors' bounding rectangles
-
getWidth()
-
-
getX()
-
-
getY()
-
-
hasFocus()
- Returns true if this Container has the keyboard focus.
-
isFocusTraversable()
-
-
isOpaque()
-
-
paint(Graphics)
-
-
paintImmediately(int, int, int, int)
- Cause the receiving JComponent to redraw the specified rectangle immediately.
-
paintImmediately(Rectangle)
-
-
processKeyEvent(KeyEvent)
- Override processKeyEvent to process events
-
processMouseMotionEvent(MouseEvent)
-
-
putProperty(Object, Object)
-
-
registerKeyboardAction(ActionListener, JKeyStroke, int)
- Register a new keyboard action.
-
removeAncestorListener(AncestorListener)
- Unregisters listener so that it will no longer receive
AncestorEvents
-
removeNotify()
-
-
removePropertyChangeListener(PropertyChangeListener)
- Remove a PropertyChangeListener from the listener list.
-
removeVetoableChangeListener(VetoableChangeListener)
- Remove a VetoableChangeListener from the listener list.
-
repaint(long, int, int, int, int)
-
-
repaint(Rectangle)
-
-
requestDefaultFocus()
- Request the focus for the component that should have the focus
by default.
-
resetKeyboardActions()
- Unregister all keyboard actions
-
scrollRectToVisible(Rectangle)
- Forwards the scrollRectToVisible() message to the JComponent's
parent.
-
setAlignmentX(float)
-
-
setAlignmentY(float)
-
-
setAutoscrolls(boolean)
- If true this component will automatically scroll it contents when
dragged, if contained in a component that supports scrolling, such as
JViewport
-
setBounds(int, int, int, int)
-
-
setDebugGraphicsOptions(int)
- Enables or disables diagnostic information about every graphics
operation performed within the JComponent or one of its children.
-
setInsets(Insets)
-
-
setMaximumSize(Dimension)
-
-
setMinimumSize(Dimension)
-
-
setPreferredSize(Dimension)
-
-
setToolTipText(String)
- Registers text as the string to be displayed in a ToolTip.
-
setUI(ComponentUI)
-
-
unregisterKeyboardAction(JKeyStroke)
- Unregister a keyboard action
-
updateUI()
- Notification from the UIFactory that the L&F
has changed.
ui
protected ComponentUI ui
propertyTable
protected Object propertyTable[]
jMouseMotionListener
protected MouseEventMulticaster jMouseMotionListener
jMouseListener
protected MouseEventMulticaster jMouseListener
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
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.
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.
UNDEFINED_CONDITION
public static final int UNDEFINED_CONDITION
- Constand 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
PARENT_PROPERTY
public static final String PARENT_PROPERTY
JComponent
public JComponent()
JComponent
public JComponent(LayoutManager2 layout)
getProperty
public Object getProperty(Object key)
- Support for a small table of per object "properties".
putProperty
public void putProperty(Object key,
Object value)
getX
public int getX()
getY
public int getY()
getWidth
public int getWidth()
getHeight
public int getHeight()
hasFocus
public boolean hasFocus()
- Returns true if this Container has the keyboard focus.
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();
}
setUI
protected void setUI(ComponentUI x)
getAppropriateGraphics
protected Graphics getAppropriateGraphics(Graphics g)
paint
public void paint(Graphics g)
- Overrides:
- paint in class Container
isOpaque
public boolean isOpaque()
setPreferredSize
public void setPreferredSize(Dimension preferredSize)
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
- getPreferredSize in class Container
setMaximumSize
public void setMaximumSize(Dimension maxSize)
getMaximumSize
public Dimension getMaximumSize()
- Overrides:
- getMaximumSize in class Container
setMinimumSize
public void setMinimumSize(Dimension minSize)
getMinimumSize
public Dimension getMinimumSize()
- Overrides:
- getMinimumSize in class Container
getInsets
public Insets getInsets()
- Overrides:
- getInsets in class Container
setInsets
public void setInsets(Insets i)
getAlignmentY
public float getAlignmentY()
- Overrides:
- getAlignmentY in class Container
setAlignmentY
public void setAlignmentY(float alignY)
getAlignmentX
public float getAlignmentX()
- Overrides:
- getAlignmentX in class Container
setAlignmentX
public void setAlignmentX(float alignX)
getGraphics
public Graphics getGraphics()
- Overrides:
- getGraphics in class Component
repaint
public void repaint(long tm,
int x,
int y,
int width,
int height)
- Overrides:
- repaint in class Component
repaint
public void repaint(Rectangle r)
paintImmediately
public void paintImmediately(int x,
int y,
int w,
int h)
- Cause the receiving JComponent to redraw the specified rectangle immediately.
paintImmediately
public void paintImmediately(Rectangle r)
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:
- 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
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:
- WHEN_FOCUSED: the action will be invoked only when the receiving JComponent has the focus.
- WHEN_FOCUSED_COMPONENT_PARENT: the action will be invoked only when the receiving JComponent has the focus.
- WHEN_IN_FOCUSED_WINDOW: the action will be invoked when the receiving JComponent has the focus
or is in the window that contains the focused container.
If an action has already been registered for the receiving
container, with the same charCode and the same modifiers, anAction will replace the action.
unregisterKeyboardAction
public void unregisterKeyboardAction(JKeyStroke aKeyStroke)
- Unregister a keyboard action
getRegisteredKeyStrokes
public JKeyStroke[] getRegisteredKeyStrokes()
- Return the KeyStroke that will perform an action
getConditionForKeyStroke
public int getConditionForKeyStroke(JKeyStroke aKeyStroke)
- Return the condition registered with an action
getActionForKeyStroke
public ActionListener getActionForKeyStroke(JKeyStroke aKeyStroke)
- Return the action registered with an action
resetKeyboardActions
public void resetKeyboardActions()
- Unregister all keyboard actions
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.
isFocusTraversable
public boolean isFocusTraversable()
- Overrides:
- isFocusTraversable in class Component
processKeyEvent
protected void processKeyEvent(KeyEvent e)
- Override processKeyEvent to process events
- Overrides:
- processKeyEvent in class Component
setToolTipText
public void setToolTipText(String text)
- Registers text as the string to be displayed in a ToolTip.
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.
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.
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.
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.
getVisibleRect
public Rectangle getVisibleRect()
- Returns the Component's "visible rect," the intersection
of the View's and all of its ancestors' bounding rectangles
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
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
getAutoscrolls
public boolean getAutoscrolls()
processMouseMotionEvent
protected void processMouseMotionEvent(MouseEvent e)
- Overrides:
- processMouseMotionEvent in class Component
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.
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
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
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.
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
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
addNotify
public void addNotify()
- Overrides:
- addNotify in class Container
removeNotify
public void removeNotify()
- Overrides:
- removeNotify in class Container
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
removeAncestorListener
public void removeAncestorListener(AncestorListener listener)
- Unregisters listener so that it will no longer receive
AncestorEvents
- See Also:
- addAncestorListener
setBounds
public void setBounds(int x,
int y,
int w,
int h)
- Overrides:
- setBounds in class Component
getBounds
public Rectangle getBounds(Rectangle dest)
- Store the receiving JComponent bounds into dest and return dest.
no new Rectangle is allocated.
getSize
public Dimension getSize(Dimension dest)
- Store the receiving JComponent dimension into dest and return dest
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