|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent
The base class for the Swing components. JComponent provides:
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.
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 FormInner Class Summary | |
class |
JComponent.AccessibleJComponent
Inner class of JComponent used to provide default support for accessibility. |
Field Summary | |
protected AccessibleContext |
accessibleContext
--- Accessibility Support --- JComponent will contain all of the methods in interface Accessible, though it won't actally implement the interface - that will be up to the individual objects which extend 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() which means that the comand 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() which means that the command should be invoked when the component has the focus. |
static int |
WHEN_IN_FOCUSED_WINDOW
Constant used for registerKeyboardAction() which 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 |
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()
Notification to this component that it now has a parent component. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. |
void |
addVetoableChangeListener(VetoableChangeListener listener)
Add 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)
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. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Support for 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)
Support for reporting constrained property changes. |
AccessibleContext |
getAccessibleContext()
Get the AccessibleContext associated with this JComponent |
ActionListener |
getActionForKeyStroke(KeyStroke aKeyStroke)
Return the object that will perform the action registered for a given keystroke. |
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)
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. |
protected Graphics |
getComponentGraphics(Graphics g)
Returns the graphics object used to paint this component. |
int |
getConditionForKeyStroke(KeyStroke aKeyStroke)
Return 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()
Return the current height of this component. |
Insets |
getInsets()
If a border has been set on this component, returns the border's insets, else calls super.getInsets. |
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 |
getMaximumSize()
If the maximumSize has been set to a non-null value just return it. |
Dimension |
getMinimumSize()
If the minimumSize has been set to a non-null value just return it. |
Component |
getNextFocusableComponent()
Return 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 return it. |
KeyStroke[] |
getRegisteredKeyStrokes()
Return the KeyStrokes that will initiate registered actions. |
JRootPane |
getRootPane()
Returns the JRootPane ancestor for a component |
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()
Return 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()
Return the UIDefaults key used to look up the name of the swing.plaf.ComponentUI class that defines the look and feel for this component. |
Rectangle |
getVisibleRect()
Returns the Component's "visible rectangle" - the intersection of this components visible rectangle: |
int |
getWidth()
Return the current width of this component. |
int |
getX()
Return the current x coordinate of the components origin. |
int |
getY()
Return the current y coordinate of the components origin. |
void |
grabFocus()
Set the focus on the receiving component. |
boolean |
hasFocus()
Returns true if this Component has the keyboard focus. |
boolean |
isDoubleBuffered()
Return 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, i.e. |
boolean |
isManagingFocus()
Override this method and return true if your JComponent manages focus. |
boolean |
isOpaque()
Returns true if this component is completely opaque. |
boolean |
isOptimizedDrawingEnabled()
Returns true if this component tiles its children, i.e. |
boolean |
isPaintingTile()
Returns true if the receiving component is currently painting a tile. |
boolean |
isRequestFocusEnabled()
Return 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)
Paint the component's border. |
protected void |
paintChildren(Graphics g)
Paint this component's children. |
protected void |
paintComponent(Graphics g)
If the UI delegate is non-null, call its paint method. |
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. |
protected String |
paramString()
Returns a string representation of this JComponent. |
protected void |
processComponentKeyEvent(KeyEvent e)
Process 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 void |
processKeyEvent(KeyEvent e)
Override 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)
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 |
removeAncestorListener(AncestorListener listener)
Unregisters listener so that it will no longer receive AncestorEvents |
void |
removeNotify()
Notification to this component that it no longer has a parent component. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. |
void |
removeVetoableChangeListener(VetoableChangeListener listener)
Remove 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()
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 |
setAlignmentX(float alignmentX)
Set the the vertical alignment. |
void |
setAlignmentY(float alignmentY)
Set 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)
Set 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 |
setMaximumSize(Dimension maximumSize)
Sets the maximumSize of this component to a constant value. |
void |
setMinimumSize(Dimension minimumSize)
Sets the minimumSize 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 components background will be filled with the background color. |
void |
setPreferredSize(Dimension preferredSize)
Set the preferred size of the receiving component. |
void |
setRequestFocusEnabled(boolean aFlag)
Set 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)
Set the look and feel delegate for this component. |
void |
setVisible(boolean aFlag)
Makes the component visible or invisible. |
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. |
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,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected transient ComponentUI ui
protected EventListenerList listenerList
public static final int WHEN_FOCUSED
public static final int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
public static final int WHEN_IN_FOCUSED_WINDOW
public static final int UNDEFINED_CONDITION
public static final String TOOL_TIP_TEXT_KEY
protected AccessibleContext accessibleContext
Constructor Detail |
public JComponent()
Method Detail |
public void updateUI()
public void updateUI() { setUI((SliderUI)UIManager.getUI(this); }
protected void setUI(ComponentUI newUI)
public void setUI(SliderUI newUI) { super.setUI(newUI); }
Additionaly JComponent subclasses must provide a getUI method that returns the correct type, e.g.
public SliderUI getUI() { return (SliderUI)ui; }
public String getUIClassID()
UIDefaults.getUI(javax.swing.JComponent)
protected Graphics getComponentGraphics(Graphics g)
protected void paintComponent(Graphics g)
paint(java.awt.Graphics)
protected void paintChildren(Graphics g)
protected void paintBorder(Graphics g)
public void update(Graphics g)
public void paint(Graphics g)
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) delegates paint
method should just override paintComponent
.
public boolean isPaintingTile()
public boolean isFocusCycleRoot()
public boolean isManagingFocus()
public void setNextFocusableComponent(Component aComponent)
public Component getNextFocusableComponent()
public void setRequestFocusEnabled(boolean aFlag)
public boolean isRequestFocusEnabled()
setRequestFocusEnabled(boolean)
public void requestFocus()
public void grabFocus()
public void setPreferredSize(Dimension preferredSize)
preferredSize
is null, the UI will
be asked for the preferred sizepublic Dimension getPreferredSize()
setPreferredSize(java.awt.Dimension)
public void setMaximumSize(Dimension maximumSize)
getMaximumSize()
public Dimension getMaximumSize()
setMaximumSize(java.awt.Dimension)
public void setMinimumSize(Dimension minimumSize)
getMinimumSize()
public Dimension getMinimumSize()
setMinimumSize(java.awt.Dimension)
public boolean contains(int x, int y)
Component.contains(int, int)
public void setBorder(Border border)
This is a bound property.
border
- the border to be rendered for this componentBorder
,
CompoundBorder
public Border getBorder()
setBorder(javax.swing.border.Border)
public Insets getInsets()
setBorder(javax.swing.border.Border)
public Insets getInsets(Insets insets)
insets
- the Insets object which can be reused.getInsets()
public float getAlignmentY()
Container.getAlignmentY
to return
the horizontal alignment.setAlignmentY(float)
,
Component.getAlignmentY()
public void setAlignmentY(float alignmentY)
getAlignmentY()
public float getAlignmentX()
Container.getAlignmentX
to return
the vertical alignment.setAlignmentX(float)
,
Component.getAlignmentX()
public void setAlignmentX(float alignmentX)
getAlignmentX()
public Graphics getGraphics()
null
if it has none.Component.paint(java.awt.Graphics)
public void setDebugGraphicsOptions(int debugOptions)
public int getDebugGraphicsOptions()
setDebugGraphicsOptions(int)
public void registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition)
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.
KeyStroke
public void registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)
public void unregisterKeyboardAction(KeyStroke aKeyStroke)
public KeyStroke[] getRegisteredKeyStrokes()
registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
public int getConditionForKeyStroke(KeyStroke aKeyStroke)
registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)
registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
public void resetKeyboardActions()
public boolean requestDefaultFocus()
public void setVisible(boolean aFlag)
Component.setVisible
.aFlag
- true to make the component visiblepublic void setEnabled(boolean enabled)
Component.isEnabled()
public void setForeground(Color fg)
Component.getForeground()
public void setBackground(Color bg)
Component.getBackground()
public void setFont(Font font)
Component.getFont()
public boolean isFocusTraversable()
protected void processFocusEvent(FocusEvent e)
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:
FocusListener
object is registered
via addFocusListener
.
enableEvents
.
e
- the focus event.FocusEvent
,
FocusListener
,
Component.addFocusListener(java.awt.event.FocusListener)
,
Component.enableEvents(long)
protected void processComponentKeyEvent(KeyEvent e)
This 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.
protected void processKeyEvent(KeyEvent e)
e
- the key event.KeyEvent
,
KeyListener
,
Component.addKeyListener(java.awt.event.KeyListener)
,
Component.enableEvents(long)
public void setToolTipText(String text)
See How to Use Tool Tips in The Java Tutorial for further documentation.
text
- The string to display. If the text is null,
the tool tip is turned off for this component.TOOL_TIP_TEXT_KEY
public String getToolTipText()
TOOL_TIP_TEXT_KEY
public String getToolTipText(MouseEvent event)
public Point getToolTipLocation(MouseEvent event)
event
- the MouseEvent that caused the ToolTipManager to
show the tooltip.public JToolTip createToolTip()
public void scrollRectToVisible(Rectangle aRect)
JViewport
public void setAutoscrolls(boolean autoscrolls)
JViewport
,
getAutoscrolls()
public boolean getAutoscrolls()
JViewport
,
setAutoscrolls(boolean)
protected void processMouseMotionEvent(MouseEvent e)
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:
MouseMotionListener
object is registered
via addMouseMotionListener
.
enableEvents
.
e
- the mouse motion event.java.awt.event.MouseMotionEvent
,
MouseMotionListener
,
Component.addMouseMotionListener(java.awt.event.MouseMotionListener)
,
Component.enableEvents(long)
public AccessibleContext getAccessibleContext()
public final Object getClientProperty(Object key)
putClientProperty
will return
a non-null value.putClientProperty(java.lang.Object, java.lang.Object)
public final void putClientProperty(Object key, Object value)
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, e.g. 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.
public static boolean isLightweightComponent(Component c)
This method will migrate to java.awt.Component in the next major JDK release
public void reshape(int x, int y, int w, int h)
Component.setBounds(int, int, int, int)
public Rectangle getBounds(Rectangle rv)
rv
- the return value, modified to the components boundspublic Dimension getSize(Dimension rv)
rv
- the return value, modified to the components sizepublic Point getLocation(Point rv)
rv
- the return value, modified to the components locationpublic int getX()
This method will migrate to java.awt.Component in the next major JDK release
public int getY()
This method will migrate to java.awt.Component in the next major JDK release
public int getWidth()
This method will migrate to java.awt.Component in the next major JDK release
public int getHeight()
This method will migrate to java.awt.Component in the next major JDK release
public boolean hasFocus()
This method will migrate to java.awt.Component in the next major JDK release
public boolean isOpaque()
An opaque component paints every pixel within its rectangular region. A non-opaque component paints only some of its pixels, allowing the pixels underneath it to "show through". A component that does not fully paint its pixels therefore provides a degree of transparency.
Subclasses that guarantee to always completely paint their contents should override this method and return true.
This method will migrate to java.awt.Component in the next major JDK release
setOpaque(boolean)
public void setOpaque(boolean isOpaque)
The default value of this property is false.
This is a JavaBeans bound property.
isOpaque()
public void computeVisibleRect(Rectangle visibleRect)
visibleRect
getVisibleRect()
public Rectangle getVisibleRect()
new Rectangle(0, 0, getWidth(), getHeight());and all of its ancestors visible Rectangles.
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
public void setFoo(int newValue) { int oldValue = foo; foo = newValue; firePropertyChange("foo", oldValue, newValue); }
This method will migrate to java.awt.Component in the next major JDK release
propertyName
- The programmatic name of the property that was changed.oldValue
- The old value of the property.newValue
- The new value of the property.PropertyChangeSupport
public void firePropertyChange(String propertyName, byte oldValue, byte newValue)
public void firePropertyChange(String propertyName, char oldValue, char newValue)
public void firePropertyChange(String propertyName, short oldValue, short newValue)
public void firePropertyChange(String propertyName, int oldValue, int newValue)
public void firePropertyChange(String propertyName, long oldValue, long newValue)
public void firePropertyChange(String propertyName, float oldValue, float newValue)
public void firePropertyChange(String propertyName, double oldValue, double newValue)
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
public void addPropertyChangeListener(PropertyChangeListener listener)
A PropertyChangeEvent will get fired in response to setting a bound property, e.g. 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.
This method will migrate to java.awt.Component in the next major JDK release
listener
- The PropertyChangeListener to be addedpublic void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
This method will migrate to java.awt.Component in the next major JDK release
listener
- The PropertyChangeListener to be removedpublic void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- The name of the property that was listened on.listener
- The PropertyChangeListener to be removedprotected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws PropertyVetoException
This method will migrate to java.awt.Component in the next major JDK release
public void addVetoableChangeListener(VetoableChangeListener listener)
This method will migrate to java.awt.Component in the next major JDK release
listener
- The VetoableChangeListener to be addedpublic void removeVetoableChangeListener(VetoableChangeListener listener)
This method will migrate to java.awt.Component in the next major JDK release
listener
- The VetoableChangeListener to be removedpublic Container getTopLevelAncestor()
public void addAncestorListener(AncestorListener listener)
This method will migrate to java.awt.Component in the next major JDK release
AncestorEvent
public void removeAncestorListener(AncestorListener listener)
This method will migrate to java.awt.Component in the next major JDK release
public void addNotify()
public void removeNotify()
public void repaint(long tm, int x, int y, int width, int height)
public void repaint(Rectangle r)
public void revalidate()
Calls invalidate() and then adds this components 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.
public boolean isValidateRoot()
revalidate()
,
Component.invalidate()
,
Container.validate()
public boolean isOptimizedDrawingEnabled()
public void paintImmediately(int x, int y, int w, int h)
It's rarely neccessary 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.
repaint(long, int, int, int, int)
public void paintImmediately(Rectangle r)
This method will migrate to java.awt.Component in the next major JDK release
public void setDoubleBuffered(boolean aFlag)
public boolean isDoubleBuffered()
public JRootPane getRootPane()
protected String paramString()
null
.
|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |