Inner class of JComponent used to provide default support for accessibility. This class is not meant to be used directly by application developers, but is instead meant only to be subclassed by component developers.

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. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .

Constant used to indicate that the supported set of actions has changed. The old value in the PropertyChangeEvent will be an Integer representing the old number of actions supported and the new value will be an Integer representing the new number of actions supported.
Constant used to determine when the active descendant of a component has changed. The active descendant is used for objects such as list, tree, and table, which may have transient children. When the active descendant has changed, the old value of the property change event will be the Accessible representing the previous active child, and the new value will be the Accessible representing the current active child.
Constant used to determine when the accessibleText caret has changed. The old value in the PropertyChangeEvent will be an integer representing the old caret position, and the new value will be an integer representing the new/current caret position.
Constant used to determine when Accessible children are added/removed from the object. If an Accessible child is being added, the old value will be null and the new value will be the Accessible child. If an Accessible child is being removed, the old value will be the Accessible child, and the new value will be null.
PropertyChangeEvent which indicates that a change has occurred in a component's bounds. The oldValue is the old component bounds and the newValue is the new component bounds.
@since
1.5
Constant used to determine when the accessibleDescription property has changed. The old value in the PropertyChangeEvent will be the old accessibleDescription and the new value will be the new accessibleDescription.
Constant used to indicate that a hypertext element has received focus. The old value in the PropertyChangeEvent will be an Integer representing the start index in the document of the previous element that had focus and the new value will be an Integer representing the start index in the document of the current element that has focus. A value of -1 indicates that an element does not or did not have focus.
PropertyChangeEvent which indicates that a significant change has occurred to the children of a component like a tree or text. This change notifies the event listener that it needs to reacquire the state of the subcomponents. The oldValue is null and the newValue is the component whose children have become invalid.
Constant used to determine when the accessibleName property has changed. The old value in the PropertyChangeEvent will be the old accessibleName and the new value will be the new accessibleName.
Constant used to determine when the accessibleSelection has changed. The old and new values in the PropertyChangeEvent are currently reserved for future use.
Constant used to determine when the accessibleStateSet property has changed. The old value will be the old AccessibleState and the new value will be the new AccessibleState in the accessibleStateSet. For example, if a component that supports the vertical and horizontal states changes its orientation from vertical to horizontal, the old value will be AccessibleState.VERTICAL and the new value will be AccessibleState.HORIZONTAL. Please note that either value can also be null. For example, when a component changes from being enabled to disabled, the old value will be AccessibleState.ENABLED and the new value will be null.
Constant used to indicate that the table caption has changed The old value in the PropertyChangeEvent will be an Accessible representing the previous table caption and the new value will be an Accessible representing the new table caption.
Constant used to indicate that the column description has changed The old value in the PropertyChangeEvent will be null and the new value will be an Integer representing the column index.
Constant used to indicate that the column header has changed The old value in the PropertyChangeEvent will be null and the new value will be an AccessibleTableModelChange representing the header change.
Constant used to indicate that table data has changed. The old value in the PropertyChangeEvent will be null and the new value will be an AccessibleTableModelChange representing the table change.
Constant used to indicate that the row description has changed The old value in the PropertyChangeEvent will be null and the new value will be an Integer representing the row index.
Constant used to indicate that the row header has changed The old value in the PropertyChangeEvent will be null and the new value will be an AccessibleTableModelChange representing the header change.
Constant used to indicate that the table summary has changed The old value in the PropertyChangeEvent will be an Accessible representing the previous table summary and the new value will be an Accessible representing the new table summary.
PropertyChangeEvent which indicates that text attributes have changed.
For attribute insertion, the oldValue is null and the newValue is an AccessibleAttributeSequence specifying the attributes that were inserted.
For attribute deletion, the oldValue is an AccessibleAttributeSequence specifying the attributes that were deleted and the newValue is null.
For attribute replacement, the oldValue is an AccessibleAttributeSequence specifying the old attributes and the newValue is an AccessibleAttributeSequence specifying the new attributes.
PropertyChangeEvent which indicates that text has changed.
For text insertion, the oldValue is null and the newValue is an AccessibleTextSequence specifying the text that was inserted.
For text deletion, the oldValue is an AccessibleTextSequence specifying the text that was deleted and the newValue is null.
For text replacement, the oldValue is an AccessibleTextSequence specifying the old text and the newValue is an AccessibleTextSequence specifying the new text.
Constant used to determine when the accessibleValue property has changed. The old value in the PropertyChangeEvent will be a Number representing the old value and the new value will be a Number representing the new value
Constant used to determine when the visual appearance of the object has changed. The old and new values in the PropertyChangeEvent are currently reserved for future use.
Adds the specified focus listener to receive focus events from this component.
Parameters
lthe focus listener
Adds a PropertyChangeListener to the listener list.
Parameters
listenerthe PropertyChangeListener to be added
Checks whether the specified point is within this object's bounds, where the point's x and y coordinates are defined to be relative to the coordinate system of the object.
Parameters
pthe Point relative to the coordinate system of the object
Return
true if object contains Point; otherwise false
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Parameters
objthe reference object with which to compare.
Return
true if this object is the same as the obj argument; false otherwise.
Support for reporting bound property changes. If oldValue and newValue are not equal and the PropertyChangeEvent listener list is not empty, then fire a PropertyChange event to each listener. In general, this is for use by the Accessible objects themselves and should not be called by an application program.
Parameters
propertyNameThe programmatic name of the property that was changed.
oldValueThe old value of the property.
newValueThe new value of the property.
Gets the AccessibleAction associated with this object that supports one or more actions.
Return
AccessibleAction if supported by object; else return null
Returns the Accessible child, if one exists, contained at the local coordinate Point.
Parameters
pthe point defining the top-left corner of the Accessible, given in the coordinate space of the object's parent
Return
the Accessible, if it exists, at the specified location; else null
Returns the nth Accessible child of the object.
Parameters
izero-based index of child
Return
the nth Accessible child of the object
Returns the number of accessible children in the object. If all of the children of this object implement Accessible, than this method should return the number of children of this object.
Return
the number of accessible children in the object.
Gets the AccessibleComponent associated with this object if one exists. Otherwise return null.
Return
the component
Gets the accessible description of this object. This should be a concise, localized description of what this object is - what is its meaning to the user. If the object has a tooltip, the tooltip text may be an appropriate string to return, assuming it contains a concise description of the object (instead of just the name of the object - for example a "Save" icon on a toolbar that had "save" as the tooltip text shouldn't return the tooltip text as the description, but something like "Saves the current text document" instead).
Return
the localized description of the object -- can be null if this object does not have a description
Gets the AccessibleEditableText associated with this object presenting editable text on the display.
Return
AccessibleEditableText if supported by object; else return null
Gets the AccessibleIcons associated with an object that has one or more associated icons
Return
an array of AccessibleIcon if supported by object; otherwise return null
Gets the index of this object in its accessible parent.
Return
the index of this object in its parent; or -1 if this object does not have an accessible parent
Returns key bindings associated with this object
Return
the key bindings, if supported, of the object; otherwise, null
Gets the accessible name of this object. This should almost never return java.awt.Component.getName(), as that generally isn't a localized name, and doesn't have meaning for the user. If the object is fundamentally a text object (such as a menu item), the accessible name should be the text of the object (for example, "save"). If the object has a tooltip, the tooltip text may also be an appropriate String to return.
Return
the localized name of the object -- can be null if this object does not have a name
Gets the Accessible parent of this object. If the parent of this object implements Accessible, this method should simply return getParent.
Return
the Accessible parent of this object -- can be null if this object does not have an Accessible parent
Gets the AccessibleRelationSet associated with an object
Return
an AccessibleRelationSet if supported by object; otherwise return null
Gets the role of this object.
Return
an instance of AccessibleRole describing the role of the object
Gets the AccessibleSelection associated with this object which allows its Accessible children to be selected.
Return
AccessibleSelection if supported by object; else return null
Gets the state of this object.
Return
an instance of AccessibleStateSet containing the current state set of the object
Gets the AccessibleTable associated with an object
Return
an AccessibleTable if supported by object; otherwise return null
Gets the AccessibleText associated with this object presenting text on the display.
Return
AccessibleText if supported by object; else return null
Gets the AccessibleValue associated with this object that supports a Numerical value.
Return
AccessibleValue if supported by object; else return null
Gets the background color of this object.
Return
the background color, if supported, of the object; otherwise, null
Gets the bounds of this object in the form of a Rectangle object. The bounds specify this object's width, height, and location relative to its parent.
Return
a rectangle indicating this component's bounds; null if this object is not on the screen
Returns the runtime class of an object. That Class object is the object that is locked by static synchronized methods of the represented class.
Return
The java.lang.Class object that represents the runtime class of the object. The result is of type {@code Class} where X is the erasure of the static type of the expression on which getClass is called.
Gets the Cursor of this object.
Return
the Cursor, if supported, of the object; otherwise, null
Gets the Font of this object.
Return
the Font, if supported, for the object; otherwise, null
Gets the FontMetrics of this object.
Parameters
fthe Font
Return
the FontMetrics, if supported, the object; otherwise, null
See Also
Gets the foreground color of this object.
Return
the foreground color, if supported, of the object; otherwise, null
Returns the locale of this object.
Return
the locale of this object
Gets the location of the object relative to the parent in the form of a point specifying the object's top-left corner in the screen's coordinate space.
Return
an instance of Point representing the top-left corner of the object's bounds in the coordinate space of the screen; null if this object or its parent are not on the screen
Returns the location of the object on the screen.
Return
location of object on screen -- can be null if this object is not on the screen
Returns the size of this object in the form of a Dimension object. The height field of the Dimension object contains this objects's height, and the width field of the Dimension object contains this object's width.
Return
a Dimension object that indicates the size of this component; null if this object is not on the screen
Returns the titled border text
Return
the titled border text, if supported, of the object; otherwise, null
Returns the tool tip text
Return
the tool tip text, if supported, of the object; otherwise, null
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Return
a hash code value for this object.
Determines if the object is enabled.
Return
true if object is enabled; otherwise, false
Returns whether this object can accept focus or not.
Return
true if object can accept focus; otherwise false
Determines if the object is showing. This is determined by checking the visibility of the object and ancestors of the object. Note: this will return true even if the object is obscured by another (for example, it happens to be underneath a menu that was pulled down).
Return
true if object is showing; otherwise, false
Determines if the object is visible. Note: this means that the object intends to be visible; however, it may not in fact be showing on the screen because one of the objects that this object is contained by is not visible. To determine if an object is showing on the screen, use isShowing.
Return
true if object is visible; otherwise, false
Wakes up a single thread that is waiting on this object's monitor. If any threads are waiting on this object, one of them is chosen to be awakened. The choice is arbitrary and occurs at the discretion of the implementation. A thread waits on an object's monitor by calling one of the wait methods.

The awakened thread will not be able to proceed until the current thread relinquishes the lock on this object. The awakened thread will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened thread enjoys no reliable privilege or disadvantage in being the next thread to lock this object.

This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways:

  • By executing a synchronized instance method of that object.
  • By executing the body of a synchronized statement that synchronizes on the object.
  • For objects of type Class, by executing a synchronized static method of that class.

Only one thread at a time can own an object's monitor.

Throws
IllegalMonitorStateExceptionif the current thread is not the owner of this object's monitor.
Wakes up all threads that are waiting on this object's monitor. A thread waits on an object's monitor by calling one of the wait methods.

The awakened threads will not be able to proceed until the current thread relinquishes the lock on this object. The awakened threads will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened threads enjoy no reliable privilege or disadvantage in being the next thread to lock this object.

This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.

Throws
IllegalMonitorStateExceptionif the current thread is not the owner of this object's monitor.
Removes the specified focus listener so it no longer receives focus events from this component.
Parameters
lthe focus listener
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.
Parameters
listenerthe PropertyChangeListener to be removed
Requests focus for this object.
Sets the accessible description of this object. Changing the name will cause a PropertyChangeEvent to be fired for the ACCESSIBLE_DESCRIPTION_PROPERTY property.
Parameters
sthe new localized description of the object
@beaninfo
preferred: true description: Sets the accessible description for the component.
Sets the localized accessible name of this object. Changing the name will cause a PropertyChangeEvent to be fired for the ACCESSIBLE_NAME_PROPERTY property.
Parameters
sthe new localized name of the object.
@beaninfo
preferred: true description: Sets the accessible name for the component.
Sets the Accessible parent of this object. This is meant to be used only in the situations where the actual component's parent should not be treated as the component's accessible parent and is a method that should only be called by the parent of the accessible child.
Parameters
a- Accessible to be set as the parent
Sets the background color of this object. (For transparency, see isOpaque.)
Parameters
cthe new Color for the background
Sets the bounds of this object in the form of a Rectangle object. The bounds specify this object's width, height, and location relative to its parent.
Parameters
ra rectangle indicating this component's bounds
Sets the Cursor of this object.
Parameters
cursorthe new Cursor for the object
Sets the enabled state of the object.
Parameters
bif true, enables this object; otherwise, disables it
Sets the Font of this object.
Parameters
fthe new Font for the object
Sets the foreground color of this object.
Parameters
cthe new Color for the foreground
Sets the location of the object relative to the parent.
Parameters
pthe coordinates of the object
Resizes this object so that it has width width and height.
Parameters
d- the dimension specifying the new size of the object
Sets the visible state of the object.
Parameters
bif true, shows this object; otherwise, hides it
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 
Return
a string representation of the object.
Causes current thread to wait until another thread invokes the method or the method for this object. In other words, this method behaves exactly as if it simply performs the call wait(0).

The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method. The thread then waits until it can re-obtain ownership of the monitor and resumes execution.

As in the one argument version, interrupts and spurious wakeups are possible, and this method should always be used in a loop:

     synchronized (obj) {
         while (<condition does not hold>)
             obj.wait();
         ... // Perform action appropriate to condition
     }
 
This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.
Throws
IllegalMonitorStateExceptionif the current thread is not the owner of the object's monitor.
InterruptedExceptionif another thread interrupted the current thread before or while the current thread was waiting for a notification. The interrupted status of the current thread is cleared when this exception is thrown.
Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.

The current thread must own this object's monitor.

This method causes the current thread (call it T) to place itself in the wait set for this object and then to relinquish any and all synchronization claims on this object. Thread T becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:

  • Some other thread invokes the notify method for this object and thread T happens to be arbitrarily chosen as the thread to be awakened.
  • Some other thread invokes the notifyAll method for this object.
  • Some other thread interrupts thread T.
  • The specified amount of real time has elapsed, more or less. If timeout is zero, however, then real time is not taken into consideration and the thread simply waits until notified.
The thread T is then removed from the wait set for this object and re-enabled for thread scheduling. It then competes in the usual manner with other threads for the right to synchronize on the object; once it has gained control of the object, all its synchronization claims on the object are restored to the status quo ante - that is, to the situation as of the time that the wait method was invoked. Thread T then returns from the invocation of the wait method. Thus, on return from the wait method, the synchronization state of the object and of thread T is exactly as it was when the wait method was invoked.

A thread can also wake up without being notified, interrupted, or timing out, a so-called spurious wakeup. While this will rarely occur in practice, applications must guard against it by testing for the condition that should have caused the thread to be awakened, and continuing to wait if the condition is not satisfied. In other words, waits should always occur in loops, like this one:

     synchronized (obj) {
         while (<condition does not hold>)
             obj.wait(timeout);
         ... // Perform action appropriate to condition
     }
 
(For more information on this topic, see Section 3.2.3 in Doug Lea's "Concurrent Programming in Java (Second Edition)" (Addison-Wesley, 2000), or Item 50 in Joshua Bloch's "Effective Java Programming Language Guide" (Addison-Wesley, 2001).

If the current thread is interrupted by another thread while it is waiting, then an InterruptedException is thrown. This exception is not thrown until the lock status of this object has been restored as described above.

Note that the wait method, as it places the current thread into the wait set for this object, unlocks only this object; any other objects on which the current thread may be synchronized remain locked while the thread waits.

This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.

Parameters
timeoutthe maximum time to wait in milliseconds.
Throws
IllegalArgumentExceptionif the value of timeout is negative.
IllegalMonitorStateExceptionif the current thread is not the owner of the object's monitor.
InterruptedExceptionif another thread interrupted the current thread before or while the current thread was waiting for a notification. The interrupted status of the current thread is cleared when this exception is thrown.
Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

This method is similar to the wait method of one argument, but it allows finer control over the amount of time to wait for a notification before giving up. The amount of real time, measured in nanoseconds, is given by:

 1000000*timeout+nanos

In all other respects, this method does the same thing as the method of one argument. In particular, wait(0, 0) means the same thing as wait(0).

The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until either of the following two conditions has occurred:

  • Another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method.
  • The timeout period, specified by timeout milliseconds plus nanos nanoseconds arguments, has elapsed.

The thread then waits until it can re-obtain ownership of the monitor and resumes execution.

As in the one argument version, interrupts and spurious wakeups are possible, and this method should always be used in a loop:

     synchronized (obj) {
         while (<condition does not hold>)
             obj.wait(timeout, nanos);
         ... // Perform action appropriate to condition
     }
 
This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.
Parameters
timeoutthe maximum time to wait in milliseconds.
nanosadditional time, in nanoseconds range 0-999999.
Throws
IllegalArgumentExceptionif the value of timeout is negative or the value of nanos is not in the range 0-999999.
IllegalMonitorStateExceptionif the current thread is not the owner of this object's monitor.
InterruptedExceptionif another thread interrupted the current thread before or while the current thread was waiting for a notification. The interrupted status of the current thread is cleared when this exception is thrown.