GNU Classpath (0.20) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
Nested Class Summary | |
abstract class |
|
Nested classes/interfaces inherited from class java.awt.Container | |
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent , Component.BltBufferStrategy , Component.FlipBufferStrategy |
Field Summary | |
static String | |
static int |
|
static int |
|
static int |
|
static int |
|
protected AccessibleContext |
|
protected EventListenerList |
|
protected ComponentUI |
|
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 | |
|
Method Summary | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
boolean |
|
JToolTip |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
protected void |
|
void |
|
void |
|
protected void |
|
AccessibleContext |
|
ActionListener |
|
ActionMap | |
float |
|
float |
|
AncestorListener[] |
|
boolean |
|
Border | |
Rectangle | |
Object |
|
protected Graphics |
|
int |
|
int |
|
static Locale | |
Graphics |
|
int |
|
InputMap | |
InputMap |
|
InputVerifier |
|
Insets | |
Insets | |
EventListener[] |
|
Point |
|
Dimension |
|
Dimension |
|
Component |
|
Dimension |
|
PropertyChangeListener[] |
|
PropertyChangeListener[] |
|
KeyStroke[] |
|
JRootPane |
|
Dimension | |
Point |
|
String |
|
String |
|
Container |
|
TransferHandler |
|
String |
|
boolean | |
VetoableChangeListener[] |
|
Rectangle |
|
int |
|
int |
|
int |
|
void |
|
boolean |
|
static boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean | |
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
void | |
protected void |
|
protected void |
|
protected void |
|
void |
|
void |
|
protected String |
|
void | |
void | |
void |
|
void |
|
void |
|
protected void |
|
protected boolean |
|
protected void |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
boolean |
|
void |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
static void | |
void |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final int UNDEFINED_CONDITION
Constant used to indicate that no condition has been assigned to a particular action.
- Field Value:
- -1
public static final int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
Constant used to indicate that an action should be performed only when the component is an ancestor of the component which has focus.
- Field Value:
- 1
public static final int WHEN_FOCUSED
Constant used to indicate that an action should be performed only when the component has focus.
- Field Value:
- 0
public static final int WHEN_IN_FOCUSED_WINDOW
Constant used to indicate that an action should be performed only when the component is in the window which has focus.
- Field Value:
- 2
protected AccessibleContext accessibleContext
Accessibility support is currently missing.
protected EventListenerList listenerList
Listeners for events other thanPropertyChangeEvent
are handled by this listener list. PropertyChangeEvents are handled inchangeSupport
.
protected ComponentUI ui
The user interface delegate for this component. Event delivery and repainting of the component are usually delegated to this object.
- See Also:
setUI(ComponentUI)
,getUIClassID()
,updateUI()
public void addAncestorListener(AncestorListener listener)
Register anAncestorListener
.
- Parameters:
listener
- The listener to register
public void addNotify()
Receives notification if this component is added to a parent component. Notification is sent to all registered AncestorListeners about the new parent. This method sets up ActionListeners for all registered KeyStrokes of this component in the chain of parent components. A PropertyChange event is fired to indicate that the ancestor property has changed. This method is used internally and should not be used in applications.
public void addPropertyChangeListener(PropertyChangeListener listener)
Register aPropertyChangeListener
. This listener will receive any PropertyChangeEvent, regardless of property name. To listen to a specific property name, useaddPropertyChangeListener(String,PropertyChangeListener)
instead.
- Overrides:
- addPropertyChangeListener in interface Container
- Parameters:
listener
- The listener to register
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Register aPropertyChangeListener
for a specific, named property. To listen to all property changes, regardless of name, useaddPropertyChangeListener(PropertyChangeListener)
instead.
- Overrides:
- addPropertyChangeListener in interface Container
- Parameters:
propertyName
- The property name to listen tolistener
- The listener to register
public void addVetoableChangeListener(VetoableChangeListener listener)
Register aVetoableChangeListener
.
- Parameters:
listener
- The listener to register
public void computeVisibleRect(Rectangle rect)
Compute the component's visible rectangle, which is defined recursively as either the component's bounds, if it has no parent, or the intersection of the component's bounds with the visible rectangle of its parent.
- Parameters:
rect
- The return value slot to place the visible rectangle in
public boolean contains(int x, int y)
Returnstrue
if the coordinates (x, y) lie within the bounds of this component andfalse
otherwise. x and y are relative to the coordinate space of the component.
- Parameters:
x
- the X coordinate of the point to checky
- the Y coordinate of the point to check
- Returns:
true
if the specified point lies within the bounds of this component,false
otherwise
public JToolTip createToolTip()
Return thetoolTip
property of this component, creating it and setting it if it is currentlynull
. This method can be overridden in subclasses which wish to control the exact form of tooltip created.
- Returns:
- The current toolTip
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
A variant offirePropertyChange(String,Object,Object)
for properties withboolean
values.
- Overrides:
- firePropertyChange in interface Component
public void firePropertyChange(String propertyName, byte oldValue, byte newValue)
A variant offirePropertyChange(String,Object,Object)
for properties withbyte
values.
public void firePropertyChange(String propertyName, char oldValue, char newValue)
A variant offirePropertyChange(String,Object,Object)
for properties withchar
values.
public void firePropertyChange(String propertyName, double oldValue, double newValue)
A variant offirePropertyChange(String,Object,Object)
for properties withdouble
values.
public void firePropertyChange(String propertyName, float oldValue, float newValue)
A variant offirePropertyChange(String,Object,Object)
for properties withfloat
values.
public void firePropertyChange(String propertyName, int oldValue, int newValue)
A variant offirePropertyChange(String,Object,Object)
for properties withint
values.
- Overrides:
- firePropertyChange in interface Component
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
CallPropertyChangeListener.propertyChange(PropertyChangeEvent)
on all listeners registered to listen to a given property. Any method which changes the specified property of this component should call this method.
- Overrides:
- firePropertyChange in interface Component
- Parameters:
propertyName
- The property which changedoldValue
- The old value of the propertynewValue
- The new value of the property
public void firePropertyChange(String propertyName, long oldValue, long newValue)
A variant offirePropertyChange(String,Object,Object)
for properties withlong
values.
public void firePropertyChange(String propertyName, short oldValue, short newValue)
A variant offirePropertyChange(String,Object,Object)
for properties withshort
values.
protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws PropertyVetoException
CallVetoableChangeListener.vetoableChange(PropertyChangeEvent)
on all listeners registered to listen to a given property. Any method which changes the specified property of this component should call this method.
- Parameters:
propertyName
- The property which changedoldValue
- The old value of the propertynewValue
- The new value of the property
- Throws:
PropertyVetoException
- if the change was vetoed by a listener
public AccessibleContext getAccessibleContext()
Get the value of the accessibleContext property for this component.
- Overrides:
- getAccessibleContext in interface Component
- Returns:
- the current value of the property
public ActionListener getActionForKeyStroke(KeyStroke ks)
Deprecated. Use
getActionMap()
Get the ActionListener (typically anAction
object) which is associated with a particular keystroke.
- Parameters:
ks
- The keystroke to retrieve the action of
- Returns:
- The action associated with the specified keystroke
public float getAlignmentX()
Get the value of thealignmentX
property.
- Overrides:
- getAlignmentX in interface Container
- Returns:
- The current value of the property.
- See Also:
setAlignmentX(float)
,alignmentY
public float getAlignmentY()
Get the value of thealignmentY
property.
- Overrides:
- getAlignmentY in interface Container
- Returns:
- The current value of the property.
- See Also:
setAlignmentY(float)
,alignmentX
public AncestorListener[] getAncestorListeners()
Return all registeredAncestorListener
objects.
- Returns:
- The set of
AncestorListener
objects inlistenerList
public boolean getAutoscrolls()
Get the current value of theautoscrolls
property.
- Returns:
- The current value of the property
public Border getBorder()
Get the value of theborder
property.
- Returns:
- The property's current value
- See Also:
setBorder(Border)
public Rectangle getBounds(Rectangle rv)
Get the component's current bounding box. If a rectangle is provided, use this as the return value (adjusting its fields in place); otherwise (ofnull
is provided) return a newRectangle
.
- Parameters:
rv
- Optional return value to use
- Returns:
- A rectangle bounding the component
public final Object getClientProperty(Object key)
Get a client property associated with this component and a particular key.
- Parameters:
key
- The key with which to look up the client property
- Returns:
- A client property associated with this object and key
- See Also:
clientProperties
,JComponent
,putClientProperty(Object,Object)
protected Graphics getComponentGraphics(Graphics g)
Prepares a graphics context for painting this object. IfdebugGraphicsOptions
is not equal toDebugGraphics.NONE_OPTION
, produce a newDebugGraphics
object wrapping the parameter. Otherwise configure the parameter with this component's foreground color and font.
- Parameters:
g
- The graphics context to wrap or configure
- Returns:
- A graphics context to paint this object with
- See Also:
debugGraphicsOptions
,paint(Graphics)
public int getConditionForKeyStroke(KeyStroke ks)
Deprecated. As of 1.3 KeyStrokes can be registered with multiple simultaneous conditions.
Return the condition that determines whether a registered action occurs in response to the specified keystroke.
- Parameters:
ks
- The keystroke to return the condition of
- Returns:
- One of the values
UNDEFINED_CONDITION
,WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
,WHEN_FOCUSED
, orWHEN_IN_FOCUSED_WINDOW
public int getDebugGraphicsOptions()
Get the value of thedebugGraphicsOptions
property.
- Returns:
- The current value of the property.
public Graphics getGraphics()
Returns the Graphics context for this component. This can be used to draw on a component.
- Overrides:
- getGraphics in interface Component
- Returns:
- the Graphics context for this component
public int getHeight()
Returns the height of this component. Prefer this method overgetBounds(Rectangle)
orgetSize(Dimension)
because it does not cause any heap allocation.
- Returns:
- the height of the component
public InputVerifier getInputVerifier()
Returns the currently set input verifier for this component.
- Returns:
- the input verifier, or
null
if none
public Insets getInsets()
Get the component's insets, which are calculated from theborder
property. If the border isnull
, callsContainer.getInsets()
.
- Returns:
- The component's current insets
public Insets getInsets(Insets insets)
Get the component's insets, which are calculated from theborder
property. If the border isnull
, callsContainer.getInsets()
. The passed-inInsets
value will be used as the return value, if possible.
- Parameters:
insets
- Return value object to reuse, if possible
- Returns:
- The component's current insets
public EventListener[] getListeners(Class listenerType)
Returns all registeredEventListener
s of the givenlistenerType
.
- Overrides:
- getListeners in interface Container
- Parameters:
listenerType
- the class of listeners to filter (null
not permitted).
- Returns:
- An array of registered listeners.
- Throws:
ClassCastException
- iflistenerType
does not implement theEventListener
interface.NullPointerException
- iflistenerType
isnull
.
- Since:
- 1.3
- See Also:
getAncestorListeners()
,listenerList
public Point getLocation(Point rv)
Get the component's location. The passed-inPoint
value will be used as the return value, if possible.
- Overrides:
- getLocation in interface Component
- Parameters:
rv
- Return value object to reuse, if possible
- Returns:
- The component's current location
public Dimension getMaximumSize()
Get the component's maximum size. If themaximumSize
property has been explicitly set, it is returned. If themaximumSize
property has not been set but theui
property has been, the result ofComponentUI.getMaximumSize(JComponent)
is returned. If neither property has been set, the result ofContainer.getMaximumSize()
is returned.
- Overrides:
- getMaximumSize in interface Container
- Returns:
- The maximum size of the component
- See Also:
maximumSize
,setMaximumSize(Dimension)
public Dimension getMinimumSize()
Get the component's minimum size. If theminimumSize
property has been explicitly set, it is returned. If theminimumSize
property has not been set but theui
property has been, the result ofComponentUI.getMinimumSize(JComponent)
is returned. If neither property has been set, the result ofContainer.getMinimumSize()
is returned.
- Overrides:
- getMinimumSize in interface Container
- Returns:
- The minimum size of the component
- See Also:
minimumSize
,setMinimumSize(Dimension)
public Component getNextFocusableComponent()
Deprecated. See
FocusTraversalPolicy
Return the value of thenextFocusableComponent
property.
- Returns:
- The current value of the property, or
null
if none has been set.
public Dimension getPreferredSize()
Get the component's preferred size. If thepreferredSize
property has been explicitly set, it is returned. If thepreferredSize
property has not been set but theui
property has been, the result ofComponentUI.getPreferredSize(JComponent)
is returned. If neither property has been set, the result ofContainer.getPreferredSize()
is returned.
- Overrides:
- getPreferredSize in interface Container
- Returns:
- The preferred size of the component
- See Also:
preferredSize
,setPreferredSize(Dimension)
public PropertyChangeListener[] getPropertyChangeListeners()
Return allPropertyChangeListener
objects registered.
- Overrides:
- getPropertyChangeListeners in interface Component
- Returns:
- The set of
PropertyChangeListener
objects
public PropertyChangeListener[] getPropertyChangeListeners(String property)
Return allPropertyChangeListener
objects registered to listen for a particular property.
- Overrides:
- getPropertyChangeListeners in interface Component
- Parameters:
property
- The property to return the listeners of
- Returns:
- The set of
PropertyChangeListener
objects inchangeSupport
registered to listen on the specified property
public KeyStroke[] getRegisteredKeyStrokes()
Return the set ofKeyStroke
objects which are registered to initiate actions on this component.
- Returns:
- An array of the registered keystrokes
public JRootPane getRootPane()
Returns the first ancestor of this component which is aJRootPane
. Equivalent to callingSwingUtilities.getRootPane(this);
.
- Returns:
- An ancestral JRootPane, or
null
if none exists.
public Dimension getSize(Dimension rv)
Get the component's size. The passed-inDimension
value will be used as the return value, if possible.
- Parameters:
rv
- Return value object to reuse, if possible
- Returns:
- The component's current size
public Point getToolTipLocation(MouseEvent event)
Return the location at which thetoolTipText
property should be displayed, when triggered by a particular mouse event.
- Parameters:
event
- The event the tooltip is being presented in response to
- Returns:
- The point at which to display a tooltip, or
null
if swing is to choose a default location.
public String getToolTipText()
Get the value of thetoolTipText
property.
- Returns:
- The current property value
- See Also:
setToolTipText(String)
public String getToolTipText(MouseEvent event)
Get the value of thetoolTipText
property, in response to a particular mouse event.
- Parameters:
event
- The mouse event which triggered the tooltip
- Returns:
- The current property value
- See Also:
setToolTipText(String)
public Container getTopLevelAncestor()
Return the top level ancestral container (usually aWindow
orApplet
) which this component is contained within, ornull
if no ancestors exist.
- Returns:
- The top level container, if it exists
public TransferHandler getTransferHandler()
Get the value of thetransferHandler
property.
- Returns:
- The current value of the property
- See Also:
setTransferHandler(TransferHandler)
public String getUIClassID()
Get the value of the UIClassID property. This property should be a key in theUIDefaults
table managed byUIManager
, the value of which is the name of a class to load for the component'sui
property.
- Returns:
- A "symbolic" name which will map to a class to use for the component's UI, such as
"ComponentUI"
- See Also:
setUI(ComponentUI)
,updateUI()
public VetoableChangeListener[] getVetoableChangeListeners()
Return all registeredVetoableChangeListener
objects.
- Returns:
- The set of
VetoableChangeListener
objects inlistenerList
public Rectangle getVisibleRect()
Return the component's visible rectangle in a newRectangle
, rather than via a return slot.
- Returns:
- The component's visible rectangle
- See Also:
computeVisibleRect(Rectangle)
public int getWidth()
Returns the width of this component. Prefer this method overgetBounds(Rectangle)
orgetSize(Dimension)
because it does not cause any heap allocation.
- Returns:
- the width of the component
public int getX()
Returns the X coordinate of the upper left corner of this component. Prefer this method overgetBounds(Rectangle)
orgetLocation(Point)
because it does not cause any heap allocation.
- Returns:
- the X coordinate of the upper left corner of the component
public int getY()
Returns the Y coordinate of the upper left corner of this component. Prefer this method overgetBounds(Rectangle)
orgetLocation(Point)
because it does not cause any heap allocation.
- Returns:
- the Y coordinate of the upper left corner of the component
public void grabFocus()
Requests that this component receive input focus, giving window focus to the top level ancestor of this component. Only works on displayable, focusable, visible components. This method should not be called by clients; it is intended for focus implementations. UseComponent.requestFocus()
instead.
- See Also:
Component.requestFocus()
public boolean isDoubleBuffered()
Get the value of thedoubleBuffered
property.
- Overrides:
- isDoubleBuffered in interface Component
- Returns:
- The property's current value
public static boolean isLightweightComponent(Component c)
Returntrue
if the provided component has no native peer; in other words, if it is a "lightweight component".
- Parameters:
c
- The component to test for lightweight-ness
- Returns:
- Whether or not the component is lightweight
public boolean isManagingFocus()
Deprecated. 1.4 Use
Component.setFocusTraversalKeys(int,Set)
andContainer.setFocusCycleRoot(boolean)
insteadReturntrue
if you wish this component to manage its own focus. In particular: if you want this component to be sentTAB
andSHIFT+TAB
key events, and to not have its children considered as focus transfer targets. Iftrue
, focus traversal around this component changes toCTRL+TAB
andCTRL+SHIFT+TAB
.
- Returns:
true
if you want this component to manage its own focus, otherwise (by default)false
public boolean isMaximumSizeSet()
Checks if a maximum size was explicitely set on the component.
- Returns:
true
if a maximum size was set,false
otherwise
- Since:
- 1.3
public boolean isMinimumSizeSet()
Checks if a minimum size was explicitely set on the component.
- Returns:
true
if a minimum size was set,false
otherwise
- Since:
- 1.3
public boolean isOpaque()
Return the current value of theopaque
property.
- Returns:
- The current property value
public boolean isOptimizedDrawingEnabled()
Returntrue
if the component can guarantee that none of its children will overlap in Z-order. This is a hint to the painting system. The default is to returntrue
, but some components such asJLayeredPane
should override this to returnfalse
.
- Returns:
- Whether the component tiles its children
public boolean isPaintingTile()
Returntrue
if this component is currently painting a tile, this means that paint() is called again on another child component. This method returnsfalse
if this component does not paint a tile or if the last tile is currently painted.
- Returns:
- whether the component is painting a tile
public boolean isPreferredSizeSet()
Checks if a preferred size was explicitely set on the component.
- Returns:
true
if a preferred size was set,false
otherwise
- Since:
- 1.3
public boolean isRequestFocusEnabled()
Get the value of therequestFocusEnabled
property.
- Returns:
- The current value of the property
public boolean isValidateRoot()
Returntrue
if this component is a validation root; this will cause calls toinvalidate()
in this component's children to be "captured" at this component, and not propagate to its parents. For most components this should returnfalse
, but some components such asJViewport
will want to returntrue
.
- Returns:
- Whether this component is a validation root
public void paint(Graphics g)
Paint the component. This is a delicate process, and should only be called from the repaint thread, under control of theRepaintManager
. Client code should usually callrepaint()
to trigger painting. The body of thepaint
call involves callingpaintComponent(Graphics)
,paintBorder(Graphics)
, andpaintChildren(Graphics)
in order. If you want to customize painting behavior, you should override one of these methods rather thanpaint
. For more details on the painting sequence, see this article.
- Parameters:
g
- The graphics context to paint with
- See Also:
paintImmediately(Rectangle)
protected void paintBorder(Graphics g)
Paint the component's border. This usually means callingBorder.paintBorder(Component,Graphics,int,int,int,int)
on theborder
property, if it is non-null
. You may override this if you wish to customize border painting behavior. The border is painted after the component's body, but before the component's children.
- Parameters:
g
- The graphics context with which to paint the border
protected void paintChildren(Graphics g)
Paint the component's children. This usually means callingContainer.paint(Graphics)
, which recursively callspaint(Graphics)
on any of the component's children, with appropriate changes to coordinate space and clipping region. You may override this if you wish to customize children painting behavior. The children are painted after the component's body and border.
- Parameters:
g
- The graphics context with which to paint the children
protected void paintComponent(Graphics g)
Paint the component's body. This usually means callingComponentUI.update(Graphics,JComponent)
on theui
property of the component, if it is non-null
. You may override this if you wish to customize the component's body-painting behavior. The component's body is painted first, before the border and children.
- Parameters:
g
- The graphics context with which to paint the body
public void paintImmediately(int x, int y, int w, int h)
A variant ofpaintImmediately(Rectangle)
which takes integer parameters.
- Parameters:
x
- The left x coordinate of the dirty regiony
- The top y coordinate of the dirty regionw
- The width of the dirty regionh
- The height of the dirty region
public void paintImmediately(Rectangle r)
Transform the provided dirty rectangle for this component into the appropriate ancestralJRootPane
and callpaint(Graphics)
on that root pane. This method is called from theRepaintManager
and should always be called within the painting thread. This method will acquire a double buffer from theRepaintManager
if the component'sdoubleBuffered
property istrue
and thepaint
call is the first recursivepaint
call inside swing. The method will also modify the providedGraphics
context via thegetComponentGraphics(Graphics)
method. If you want to customize the graphics object used for painting, you should override that method rather thanpaint
.
- Parameters:
r
- The dirty rectangle to paint
protected String paramString()
Return a string representation for this component, for use in debugging.
- Overrides:
- paramString in interface Container
- Returns:
- A string describing this component.
public void print(Graphics g)
Prints this component to the given Graphics context. A call to this method results in calls to the methodsprintComponent(Graphics)
,printBorder(Graphics)
andprintChildren(Graphics)
in this order. Double buffering is temporarily turned off so the painting goes directly to the supplied Graphics context.
- Parameters:
g
- the Graphics context to print onto
public void printAll(Graphics g)
Prints this component to the given Graphics context. This invokesprint(Graphics)
.
- Parameters:
g
- the Graphics context to print onto
public void printBorder(Graphics g)
Print this component's border to the specified Graphics context. The default behaviour is to invokepaintBorder(Graphics)
. Override this if you want special behaviour for printing.
- Parameters:
g
- the Graphics context to print onto
- Since:
- 1.3
public void printChildren(Graphics g)
Print this component's children to the specified Graphics context. The default behaviour is to invokepaintChildren(Graphics)
. Override this if you want special behaviour for printing.
- Parameters:
g
- the Graphics context to print onto
- Since:
- 1.3
public void printComponent(Graphics g)
Prints this component to the specified Graphics context. The default behaviour is to invokepaintComponent(Graphics)
. Override this if you want special behaviour for printing.
- Parameters:
g
- the Graphics context to print onto
- Since:
- 1.3
protected void processComponentKeyEvent(KeyEvent e)
A hook for subclasses which want to customize event processing.
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
protected void processKeyEvent(KeyEvent e)
Override the default key dispatch system from Component to hook into the swingInputMap
/ActionMap
system. See this report for more details, it's somewhat complex.
- Overrides:
- processKeyEvent in interface Component
protected void processMouseMotionEvent(MouseEvent ev)
Processes mouse motion event, like dragging and moving.
- Overrides:
- processMouseMotionEvent in interface Component
- Parameters:
ev
- the MouseEvent describing the mouse motion
public final void putClientProperty(Object key, Object value)
Add a client propertyvalue
to this component, associated withkey
. If there is an existing client property associated withkey
, it will be replaced. APropertyChangeEvent
is sent to registered listeners (with the name of the property beingkey.toString()
).
- Parameters:
key
- The key of the client property association to addvalue
- The value of the client property association to add
- See Also:
clientProperties
,JComponent
,getClientProperty(Object)
public void registerKeyboardAction(ActionListener act, String cmd, KeyStroke stroke, int cond)
An obsolete method to register a keyboard action on this component. You should usegetInputMap
andgetActionMap
to fetch mapping tables from keystrokes to commands, and commands to actions, respectively, and modify those mappings directly.
- Parameters:
act
- The action to be registeredcmd
- The command to deliver in the deliveredActionEvent
stroke
- The keystroke to register oncond
- One of the valuesUNDEFINED_CONDITION
,WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
,WHEN_FOCUSED
, orWHEN_IN_FOCUSED_WINDOW
, indicating the condition which must be met for the action to be fired
public void registerKeyboardAction(ActionListener act, KeyStroke stroke, int cond)
A variant ofregisterKeyboardAction(ActionListener,String,KeyStroke,int)
which providesnull
for the command name.
public void removeAncestorListener(AncestorListener listener)
Unregister anAncestorListener
.
- Parameters:
listener
- The listener to unregister
public void removeNotify()
Receives notification that this component no longer has a parent. This method sends an AncestorEvent to all registered AncestorListeners, notifying them that the parent is gone. The keybord actions of this component are removed from the parent and its ancestors. A PropertyChangeEvent is fired to indicate that the 'ancestor' property has changed. This method is called before the component is actually removed from its parent, so the parent is still visible throughComponent.getParent()
.
- Overrides:
- removeNotify in interface Container
public void removePropertyChangeListener(PropertyChangeListener listener)
Unregister aPropertyChangeListener
.
- Overrides:
- removePropertyChangeListener in interface Component
- Parameters:
listener
- The listener to register
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
Unregister aPropertyChangeListener
.
- Overrides:
- removePropertyChangeListener in interface Component
- Parameters:
propertyName
- The property name to unregister the listener fromlistener
- The listener to unregister
public void removeVetoableChangeListener(VetoableChangeListener listener)
Unregister aVetoableChangeChangeListener
.
- Parameters:
listener
- The listener to unregister
public void repaint(Rectangle r)
Mark the described region of this component as dirty in the currentRepaintManager
. This will queue an asynchronous repaint using the system painting thread in the near future.
- Parameters:
r
- The rectangle to mark as dirty
public void repaint(long tm, int x, int y, int width, int height)
Mark the described region of this component as dirty in the currentRepaintManager
. This will queue an asynchronous repaint using the system painting thread in the near future.
- Parameters:
tm
- ignoredx
- coordinate of the region to mark as dirtyy
- coordinate of the region to mark as dirtywidth
- dimension of the region to mark as dirtyheight
- dimension of the region to mark as dirty
public boolean requestDefaultFocus()
Deprecated. Use
requestFocus()
on the default component provided from theFocusTraversalPolicy
instead.Request focus on the default component of this component'sFocusTraversalPolicy
.
- Returns:
- The result of
requestFocus()
public void requestFocus()
Requests that this component gets the input focus if the requestFocusEnabled property is set totrue
. This also means that this component's top-level window becomes the focused window, if that is not already the case. The preconditions that have to be met to become a focus owner is that the component must be displayable, visible and focusable. Note that this signals only a request for becoming focused. There are situations in which it is not possible to get the focus. So developers should not assume that the component has the focus until it receives aFocusEvent
with a value ofFocusEvent.FOCUS_GAINED
.
- Overrides:
- requestFocus in interface Component
- See Also:
Component.requestFocus()
public boolean requestFocus(boolean temporary)
This method is overridden to make it public so that it can be used by look and feel implementations. You should not use this method directly. Instead you are strongly encouraged to callrequestFocus()
orrequestFocusInWindow()
instead.
- Overrides:
- requestFocus in interface Component
- Parameters:
temporary
- if the focus change is temporary
- Returns:
false
if the focus change request will definitly fail,true
if it will likely succeed
- Since:
- 1.4
- See Also:
Component.requestFocus(boolean)
public boolean requestFocusInWindow()
Requests that this component gets the input focus if the top level window that contains this component has the focus and the requestFocusEnabled property is set totrue
. The preconditions that have to be met to become a focus owner is that the component must be displayable, visible and focusable. Note that this signals only a request for becoming focused. There are situations in which it is not possible to get the focus. So developers should not assume that the component has the focus until it receives aFocusEvent
with a value ofFocusEvent.FOCUS_GAINED
.
- Overrides:
- requestFocusInWindow in interface Component
- Returns:
false
if the focus change request will definitly fail,true
if it will likely succeed
- See Also:
Component.requestFocusInWindow()
public boolean requestFocusInWindow(boolean temporary)
This method is overridden to make it public so that it can be used by look and feel implementations. You should not use this method directly. Instead you are strongly encouraged to callrequestFocus()
orrequestFocusInWindow()
instead.
- Overrides:
- requestFocusInWindow in interface Component
- Parameters:
temporary
- if the focus change is temporary
- Returns:
false
if the focus change request will definitly fail,true
if it will likely succeed
- Since:
- 1.4
- See Also:
Component.requestFocus(boolean)
public void reshape(int x, int y, int w, int h)
Moves and resizes the component.
- Parameters:
x
- the new horizontal locationy
- the new vertial locationw
- the new widthh
- the new height
public void revalidate()
Queue a an invalidation and revalidation of this component, usingRepaintManager.addInvalidComponent(JComponent)
.
public void scrollRectToVisible(Rectangle r)
CallsscrollRectToVisible
on the component's parent. Components which can service this call should override.
- Parameters:
r
- The rectangle to make visible
public void setAlignmentX(float a)
Set the value of thealignmentX
property.
- Parameters:
a
- The new value of the property
public void setAlignmentY(float a)
Set the value of thealignmentY
property.
- Parameters:
a
- The new value of the property
public void setAutoscrolls(boolean a)
Set the value of theautoscrolls
property.
- Parameters:
a
- The new value of the property
public void setBackground(Color bg)
Set the value of thebackground
property.
- Overrides:
- setBackground in interface Component
- Parameters:
bg
- The new value of the property
public void setBorder(Border newBorder)
Set the value of theborder
property.
- Parameters:
newBorder
- The new value of the property
- See Also:
getBorder()
public void setDebugGraphicsOptions(int debugOptions)
Set the value of thedebugGraphicsOptions
property.
- Parameters:
debugOptions
- The new value of the property
public void setDoubleBuffered(boolean db)
Set the value of thedoubleBuffered
property.
- Parameters:
db
- The new value of the property
public void setEnabled(boolean enable)
Set the value of theenabled
property.
- Overrides:
- setEnabled in interface Component
- Parameters:
enable
- The new value of the property
public void setFont(Font f)
Set the value of thefont
property.
- Parameters:
f
- The new value of the property
public void setForeground(Color fg)
Set the value of theforeground
property.
- Overrides:
- setForeground in interface Component
- Parameters:
fg
- The new value of the property
public void setInputVerifier(InputVerifier verifier)
Sets the input verifier to use by this component.
- Parameters:
verifier
- the input verifier, ornull
public void setMaximumSize(Dimension max)
Set the value of themaximumSize
property. The passed value is copied, the later direct changes on the argument have no effect on the property value.
- Parameters:
max
- The new value of the property
public void setMinimumSize(Dimension min)
Set the value of theminimumSize
property. The passed value is copied, the later direct changes on the argument have no effect on the property value.
- Parameters:
min
- The new value of the property
public void setNextFocusableComponent(Component aComponent)
Deprecated. Use FocusTraversalPolicy instead
Set the specified component to be the next component in the focus cycle, overriding theFocusTraversalPolicy
for this component.
- Parameters:
aComponent
- The component to set as the next focusable
public void setOpaque(boolean isOpaque)
Set the value of theopaque
property.
- Parameters:
isOpaque
- The new value of the property
public void setPreferredSize(Dimension pref)
Set the value of thepreferredSize
property. The passed value is copied, the later direct changes on the argument have no effect on the property value.
- Parameters:
pref
- The new value of the property
public void setRequestFocusEnabled(boolean e)
Set the value of therequestFocusEnabled
property.
- Parameters:
e
- The new value of the property
public void setToolTipText(String text)
Set the value of thetoolTipText
property.
- Parameters:
text
- The new property value
- See Also:
getToolTipText()
public void setTransferHandler(TransferHandler newHandler)
Set the value of thetransferHandler
property.
- Parameters:
newHandler
- The new value of the property
- See Also:
getTransferHandler()
protected void setUI(ComponentUI newUI)
Install a new UI delegate as the component'sui
property. In the process, this will callComponentUI.uninstallUI(JComponent)
on any existing value for theui
property, andComponentUI.installUI(JComponent)
on the new UI delegate.
- Parameters:
newUI
- The new UI delegate to install
- See Also:
updateUI()
,getUIClassID()
public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget)
- Since:
- 1.3
public void setVisible(boolean v)
Set the value of the visible property. If the value is changed, then the AncestorListeners of this component and all its children (recursivly) are notified.
- Overrides:
- setVisible in interface Component
- Parameters:
v
- The new value of the property
public void unregisterKeyboardAction(KeyStroke aKeyStroke)
Remove a keyboard action registry.
- Parameters:
aKeyStroke
- The keystroke to unregister
public void update(Graphics g)
Callpaint(Graphics)
.
- Parameters:
g
- The graphics context to paint into
public void updateUI()
This method should be overridden in subclasses. In JComponent, the method does nothing. In subclasses, it should a UI delegate (corresponding to the symbolic name returned fromgetUIClassID()
) from theUIManager
, and callssetUI(ComponentUI)
with the new delegate.
GNU Classpath (0.20) |