This class implements accessibility for JTable header cells.
Method from javax.swing.JTable$AccessibleJTable$AccessibleJTableHeaderCell Detail: |
public void addFocusListener(FocusListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).addFocusListener(l);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.addFocusListener(l);
}
}
}
Adds the specified focus listener to receive focus events from this
component. |
public void addPropertyChangeListener(PropertyChangeListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
ac.addPropertyChangeListener(l);
} else {
super.addPropertyChangeListener(l);
}
}
Adds a PropertyChangeListener to the listener list.
The listener is registered for all properties. |
public boolean contains(Point p) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
Rectangle r = ((AccessibleComponent) ac).getBounds();
return r.contains(p);
} else {
Component c = getCurrentComponent();
if (c != null) {
Rectangle r = c.getBounds();
return r.contains(p);
} else {
return getBounds().contains(p);
}
}
}
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. |
public AccessibleAction getAccessibleAction() {
return getCurrentAccessibleContext().getAccessibleAction();
}
Gets the AccessibleAction associated with this
object if one exists. Otherwise returns null . |
public Accessible getAccessibleAt(Point p) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getAccessibleAt(p);
} else {
return null;
}
}
Returns the Accessible child, if one exists, contained at the local
coordinate Point. |
public Accessible getAccessibleChild(int i) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
Accessible accessibleChild = ac.getAccessibleChild(i);
ac.setAccessibleParent(this);
return accessibleChild;
} else {
return null;
}
}
Returns the specified Accessible child of the
object. |
public int getAccessibleChildrenCount() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
return ac.getAccessibleChildrenCount();
} else {
return 0;
}
}
Returns the number of accessible children in the object. |
public AccessibleComponent getAccessibleComponent() {
return this; // to override getBounds()
}
Gets the AccessibleComponent associated with
this object if one exists. Otherwise returns null . |
public AccessibleContext getAccessibleContext() {
return this;
}
Gets the AccessibleContext associated with this
component. In the implementation of the Java Accessibility
API for this class, return this object, which is its own
AccessibleContext . |
public String getAccessibleDescription() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
return ac.getAccessibleDescription();
} else {
return super.getAccessibleDescription();
}
}
Gets the accessible description of this object. |
public int getAccessibleIndexInParent() {
return column;
}
Gets the index of this object in its accessible parent. |
public String getAccessibleName() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
String name = ac.getAccessibleName();
if ((name != null) && (name != "")) {
return ac.getAccessibleName();
}
}
if ((accessibleName != null) && (accessibleName != "")) {
return accessibleName;
} else {
return null;
}
}
Gets the accessible name of this object. |
public Accessible getAccessibleParent() {
return parent;
}
Gets the Accessible parent of this object. |
public AccessibleRole getAccessibleRole() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
return ac.getAccessibleRole();
} else {
return AccessibleRole.UNKNOWN;
}
}
Gets the role of this object. |
public AccessibleSelection getAccessibleSelection() {
return getCurrentAccessibleContext().getAccessibleSelection();
}
Gets the AccessibleSelection associated with
this object if one exists. Otherwise returns null . |
public AccessibleStateSet getAccessibleStateSet() {
AccessibleContext ac = getCurrentAccessibleContext();
AccessibleStateSet as = null;
if (ac != null) {
as = ac.getAccessibleStateSet();
}
if (as == null) {
as = new AccessibleStateSet();
}
Rectangle rjt = JTable.this.getVisibleRect();
Rectangle rcell = JTable.this.getCellRect(row, column, false);
if (rjt.intersects(rcell)) {
as.add(AccessibleState.SHOWING);
} else {
if (as.contains(AccessibleState.SHOWING)) {
as.remove(AccessibleState.SHOWING);
}
}
if (JTable.this.isCellSelected(row, column)) {
as.add(AccessibleState.SELECTED);
} else if (as.contains(AccessibleState.SELECTED)) {
as.remove(AccessibleState.SELECTED);
}
if ((row == getSelectedRow()) && (column == getSelectedColumn())) {
as.add(AccessibleState.ACTIVE);
}
as.add(AccessibleState.TRANSIENT);
return as;
}
Gets the state set of this object. |
public AccessibleText getAccessibleText() {
return getCurrentAccessibleContext().getAccessibleText();
}
Gets the AccessibleText associated with this
object if one exists. Otherwise returns null . |
public AccessibleValue getAccessibleValue() {
return getCurrentAccessibleContext().getAccessibleValue();
}
Gets the AccessibleValue associated with
this object if one exists. Otherwise returns null . |
public Color getBackground() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getBackground();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getBackground();
} else {
return null;
}
}
}
Gets the background color of this object. |
public Rectangle getBounds() {
if (parent != null) {
return parent.getHeaderRect(column);
} else {
return 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. |
public Cursor getCursor() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getCursor();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getCursor();
} else {
Accessible ap = getAccessibleParent();
if (ap instanceof AccessibleComponent) {
return ((AccessibleComponent) ap).getCursor();
} else {
return null;
}
}
}
}
Gets the Cursor of this object. |
public Font getFont() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getFont();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getFont();
} else {
return null;
}
}
}
Gets the Font of this object. |
public FontMetrics getFontMetrics(Font f) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getFontMetrics(f);
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getFontMetrics(f);
} else {
return null;
}
}
}
Gets the FontMetrics of this object. |
public Color getForeground() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getForeground();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getForeground();
} else {
return null;
}
}
}
Gets the foreground color of this object. |
public Locale getLocale() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
return ac.getLocale();
} else {
return null;
}
}
Gets the locale of the component. If the component
does not have a locale, then the locale of its parent
is returned. |
public Point getLocation() {
if (parent != null) {
Rectangle r = parent.getHeaderRect(column);
if (r != null) {
return r.getLocation();
}
}
return null;
}
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. |
public Point getLocationOnScreen() {
if (parent != null) {
Point parentLocation = parent.getLocationOnScreen();
Point componentLocation = getLocation();
componentLocation.translate(parentLocation.x, parentLocation.y);
return componentLocation;
} else {
return null;
}
}
Returns the location of the object on the screen. |
public Dimension getSize() {
if (parent != null) {
Rectangle r = parent.getHeaderRect(column);
if (r != null) {
return r.getSize();
}
}
return null;
}
Returns the size of this object in the form of a Dimension object.
The height field of the Dimension object contains this object's
height, and the width field of the Dimension object contains this
object's width. |
public boolean isEnabled() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).isEnabled();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isEnabled();
} else {
return false;
}
}
}
Determines if the object is enabled. |
public boolean isFocusTraversable() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).isFocusTraversable();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isFocusTraversable();
} else {
return false;
}
}
}
Returns whether this object can accept focus or not. Objects that
can accept focus will also have the AccessibleState.FOCUSABLE state
set in their AccessibleStateSets. |
public boolean isShowing() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
if (ac.getAccessibleParent() != null) {
return ((AccessibleComponent) ac).isShowing();
} else {
// Fixes 4529616 - AccessibleJTableCell.isShowing()
// returns false when the cell on the screen
// if no parent
return isVisible();
}
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isShowing();
} else {
return 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). |
public boolean isVisible() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).isVisible();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isVisible();
} else {
return false;
}
}
}
Determines if this 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 . |
public void removeFocusListener(FocusListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).removeFocusListener(l);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.removeFocusListener(l);
}
}
}
Removes the specified focus listener so it no longer receives focus
events from this component. |
public void removePropertyChangeListener(PropertyChangeListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
ac.removePropertyChangeListener(l);
} else {
super.removePropertyChangeListener(l);
}
}
Removes a PropertyChangeListener from the
listener list. This removes a PropertyChangeListener
that was registered for all properties. |
public void requestFocus() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).requestFocus();
} else {
Component c = getCurrentComponent();
if (c != null) {
c.requestFocus();
}
}
}
Requests focus for this object. If this object cannot accept focus,
nothing will happen. Otherwise, the object will attempt to take
focus. |
public void setAccessibleDescription(String s) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
ac.setAccessibleDescription(s);
} else {
super.setAccessibleDescription(s);
}
}
Sets the accessible description of this object. |
public void setAccessibleName(String s) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
ac.setAccessibleName(s);
} else {
super.setAccessibleName(s);
}
}
Sets the localized accessible name of this object. |
public void setBackground(Color c) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setBackground(c);
} else {
Component cp = getCurrentComponent();
if (cp != null) {
cp.setBackground(c);
}
}
}
Sets the background color of this object. |
public void setBounds(Rectangle r) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setBounds(r);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setBounds(r);
}
}
}
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. |
public void setCursor(Cursor c) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setCursor(c);
} else {
Component cp = getCurrentComponent();
if (cp != null) {
cp.setCursor(c);
}
}
}
Sets the Cursor of this object. |
public void setEnabled(boolean b) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setEnabled(b);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setEnabled(b);
}
}
}
Sets the enabled state of the object. |
public void setFont(Font f) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setFont(f);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setFont(f);
}
}
}
Sets the Font of this object. |
public void setForeground(Color c) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setForeground(c);
} else {
Component cp = getCurrentComponent();
if (cp != null) {
cp.setForeground(c);
}
}
}
Sets the foreground color of this object. |
public void setLocation(Point p) {
}
Sets the location of the object relative to the parent. |
public void setSize(Dimension d) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setSize(d);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setSize(d);
}
}
}
Resizes this object so that it has width and height. |
public void setVisible(boolean b) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setVisible(b);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setVisible(b);
}
}
}
Sets the visible state of the object. |