Method from javax.swing.JComponent$AccessibleJComponent Detail: |
public void addPropertyChangeListener(PropertyChangeListener listener) {
if (accessibleFocusHandler == null) {
accessibleFocusHandler = new AccessibleFocusHandler();
JComponent.this.addFocusListener(accessibleFocusHandler);
}
if (accessibleContainerHandler == null) {
accessibleContainerHandler = new AccessibleContainerHandler();
JComponent.this.addContainerListener(accessibleContainerHandler);
}
super.addPropertyChangeListener(listener);
}
Adds a PropertyChangeListener to the listener list. |
public Accessible getAccessibleChild(int i) {
return super.getAccessibleChild(i);
}
Returns the nth Accessible child of the object. |
public int getAccessibleChildrenCount() {
return super.getAccessibleChildrenCount();
}
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. |
public String getAccessibleDescription() {
String description = accessibleDescription;
// fallback to the client description property
//
if (description == null) {
description = (String)getClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY);
}
// fallback to the tool tip text if it exists
//
if (description == null) {
try {
description = getToolTipText();
} catch (Exception e) {
// Just in case the subclass overrode the
// getToolTipText method and actually
// requires a MouseEvent.
// [[[FIXME: WDW - we probably should require this
// method to take a MouseEvent and just pass it on
// to getToolTipText. The swing-feedback traffic
// leads me to believe getToolTipText might change,
// though, so I was hesitant to make this change at
// this time.]]]
}
}
// fallback to the label labeling us if it exists
//
if (description == null) {
Object o = getClientProperty(JLabel.LABELED_BY_PROPERTY);
if (o instanceof Accessible) {
AccessibleContext ac = ((Accessible) o).getAccessibleContext();
if (ac != null) {
description = ac.getAccessibleDescription();
}
}
}
return description;
}
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). |
AccessibleExtendedComponent getAccessibleExtendedComponent() {
return this;
}
Returns the AccessibleExtendedComponent |
public AccessibleKeyBinding getAccessibleKeyBinding() {
return null;
}
Returns key bindings associated with this object |
public String getAccessibleName() {
String name = accessibleName;
// fallback to the client name property
//
if (name == null) {
name = (String)getClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY);
}
// fallback to the titled border if it exists
//
if (name == null) {
name = getBorderTitle(getBorder());
}
// fallback to the label labeling us if it exists
//
if (name == null) {
Object o = getClientProperty(JLabel.LABELED_BY_PROPERTY);
if (o instanceof Accessible) {
AccessibleContext ac = ((Accessible) o).getAccessibleContext();
if (ac != null) {
name = ac.getAccessibleName();
}
}
}
return name;
}
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. |
public AccessibleRole getAccessibleRole() {
return AccessibleRole.SWING_COMPONENT;
}
Gets the role of this object. |
public AccessibleStateSet getAccessibleStateSet() {
AccessibleStateSet states = super.getAccessibleStateSet();
if (JComponent.this.isOpaque()) {
states.add(AccessibleState.OPAQUE);
}
return states;
}
Gets the state of this object. |
protected String getBorderTitle(Border b) {
String s;
if (b instanceof TitledBorder) {
return ((TitledBorder) b).getTitle();
} else if (b instanceof CompoundBorder) {
s = getBorderTitle(((CompoundBorder) b).getInsideBorder());
if (s == null) {
s = getBorderTitle(((CompoundBorder) b).getOutsideBorder());
}
return s;
} else {
return null;
}
}
Recursively search through the border hierarchy (if it exists)
for a TitledBorder with a non-null title. This does a depth
first search on first the inside borders then the outside borders.
The assumption is that titles make really pretty inside borders
but not very pretty outside borders in compound border situations.
It's rather arbitrary, but hopefully decent UI programmers will
not create multiple titled borders for the same component. |
public String getTitledBorderText() {
Border border = JComponent.this.getBorder();
if (border instanceof TitledBorder) {
return ((TitledBorder)border).getTitle();
} else {
return null;
}
}
Returns the titled border text |
public String getToolTipText() {
return JComponent.this.getToolTipText();
}
Returns the tool tip text |
public void removePropertyChangeListener(PropertyChangeListener listener) {
if (accessibleFocusHandler != null) {
JComponent.this.removeFocusListener(accessibleFocusHandler);
accessibleFocusHandler = null;
}
super.removePropertyChangeListener(listener);
}
Removes a PropertyChangeListener from the listener list.
This removes a PropertyChangeListener that was registered
for all properties. |