javax.swing
Class JTable.AccessibleJTable.AccessibleJTableCell

java.lang.Object
  extended by javax.accessibility.AccessibleContext
      extended by javax.swing.JTable.AccessibleJTable.AccessibleJTableCell
All Implemented Interfaces:
Accessible, AccessibleComponent
Enclosing class:
JTable.AccessibleJTable

protected class JTable.AccessibleJTable.AccessibleJTableCell
extends AccessibleContext
implements Accessible, AccessibleComponent

Provides accessibility support for table cells.


Field Summary
 
Fields inherited from class javax.accessibility.AccessibleContext
ACCESSIBLE_ACTION_PROPERTY, ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY, ACCESSIBLE_CARET_PROPERTY, ACCESSIBLE_CHILD_PROPERTY, ACCESSIBLE_COMPONENT_BOUNDS_CHANGED, ACCESSIBLE_DESCRIPTION_PROPERTY, ACCESSIBLE_HYPERTEXT_OFFSET, ACCESSIBLE_INVALIDATE_CHILDREN, ACCESSIBLE_NAME_PROPERTY, ACCESSIBLE_SELECTION_PROPERTY, ACCESSIBLE_STATE_PROPERTY, ACCESSIBLE_TABLE_CAPTION_CHANGED, ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED, ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED, ACCESSIBLE_TABLE_MODEL_CHANGED, ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED, ACCESSIBLE_TABLE_ROW_HEADER_CHANGED, ACCESSIBLE_TABLE_SUMMARY_CHANGED, ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED, ACCESSIBLE_TEXT_PROPERTY, ACCESSIBLE_VALUE_PROPERTY, ACCESSIBLE_VISIBLE_DATA_PROPERTY, accessibleDescription, accessibleName, accessibleParent
 
Constructor Summary
JTable.AccessibleJTable.AccessibleJTableCell(JTable t, int r, int c, int i)
          Creates a new AccessibleJTableCell.
 
Method Summary
 void addFocusListener(FocusListener listener)
          Adds a focus listener to this cell.
 boolean contains(Point point)
          Returns true if this table cell contains the location at point, false otherwise.
 Accessible getAccessibleAt(Point point)
          Table cells have no children, so we return null here.
 Accessible getAccessibleChild(int i)
          Returns the accessible child at index i.
 int getAccessibleChildrenCount()
          Returns the number of children of this object.
 AccessibleContext getAccessibleContext()
          Returns the accessible context of this table cell.
 int getAccessibleIndexInParent()
          Returns the index of this cell in the parent object.
 AccessibleRole getAccessibleRole()
          Returns the accessible row for the table cell.
 AccessibleStateSet getAccessibleStateSet()
          Returns the accessible state set of this accessible table cell.
 Color getBackground()
          Returns the background color of this cell.
 Rectangle getBounds()
          Returns the bounds of the cell relative to its table.
 Cursor getCursor()
          Returns the cursor for this table cell.
 Font getFont()
          Returns the font of the table cell.
 FontMetrics getFontMetrics(Font font)
          Returns the font metrics for a specified font.
 Color getForeground()
          Returns the foreground color of the table cell.
 Locale getLocale()
          Returns the locale setting for this accessible table cell.
 Point getLocation()
          Returns the location of this cell relative to the table's bounds.
 Point getLocationOnScreen()
          Returns the screen location of the table cell.
 Dimension getSize()
          Returns the size of the table cell.
 boolean isEnabled()
          Returns true if this table cell is enabled, false otherwise.
 boolean isFocusTraversable()
          Returns true if this table cell is focus traversable, false otherwise.
 boolean isShowing()
          Returns true if this table cell is currently showing on screen.
 boolean isVisible()
          Returns true if this cell is visible, false otherwise.
 void removeFocusListener(FocusListener listener)
          Removes a focus listener from the cell.
 void requestFocus()
          Requests that this table cell gets the keyboard focus.
 void setBackground(Color color)
          Sets the background of the cell.
 void setBounds(Rectangle rectangle)
          The bounds of the table cells cannot be manipulated directly, so this method does nothing.
 void setCursor(Cursor cursor)
          Sets the cursor of the cell.
 void setEnabled(boolean b)
          Table cells cannot be disabled or enabled individually, so this method does nothing.
 void setFont(Font font)
          Sets the font of the cell.
 void setForeground(Color color)
          Sets the foreground of the cell.
 void setLocation(Point point)
          The location of the table cells cannot be manipulated directly, so this method does nothing.
 void setSize(Dimension dimension)
          The size cannot be set on table cells directly, so this method does nothing.
 void setVisible(boolean b)
          The visibility cannot be set on individual table cells, so this method does nothing.
 
Methods inherited from class javax.accessibility.AccessibleContext
addPropertyChangeListener, firePropertyChange, getAccessibleAction, getAccessibleComponent, getAccessibleDescription, getAccessibleEditableText, getAccessibleIcon, getAccessibleName, getAccessibleParent, getAccessibleRelationSet, getAccessibleSelection, getAccessibleTable, getAccessibleText, getAccessibleValue, removePropertyChangeListener, setAccessibleDescription, setAccessibleName, setAccessibleParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JTable.AccessibleJTable.AccessibleJTableCell

public JTable.AccessibleJTable.AccessibleJTableCell(JTable t,
                                                    int r,
                                                    int c,
                                                    int i)
Creates a new AccessibleJTableCell.

Parameters:
t - the table
r - the row
c - the column
i - the index of this cell inside the accessible table parent
Method Detail

getAccessibleRole

public AccessibleRole getAccessibleRole()
Returns the accessible row for the table cell.

Specified by:
getAccessibleRole in class AccessibleContext
Returns:
the accessible row for the table cell
See Also:
AccessibleRole

getAccessibleStateSet

public AccessibleStateSet getAccessibleStateSet()
Returns the accessible state set of this accessible table cell.

Specified by:
getAccessibleStateSet in class AccessibleContext
Returns:
the accessible state set of this accessible table cell
See Also:
AccessibleState, AccessibleStateSet, AccessibleContext.addPropertyChangeListener(PropertyChangeListener)

getAccessibleIndexInParent

public int getAccessibleIndexInParent()
Returns the index of this cell in the parent object.

Specified by:
getAccessibleIndexInParent in class AccessibleContext
Returns:
the index of this cell in the parent object
See Also:
AccessibleContext.getAccessibleParent(), AccessibleContext.getAccessibleChildrenCount(), AccessibleContext.getAccessibleChild(int)

getAccessibleChildrenCount

public int getAccessibleChildrenCount()
Returns the number of children of this object. Table cells cannot have children, so we return 0 here.

Specified by:
getAccessibleChildrenCount in class AccessibleContext
Returns:
0
See Also:
AccessibleContext.getAccessibleChild(int)

getAccessibleChild

public Accessible getAccessibleChild(int i)
Returns the accessible child at index i. Table cells don't have children, so we return null here.

Specified by:
getAccessibleChild in class AccessibleContext
Parameters:
i - the 0-based index to get
Returns:
null
See Also:
AccessibleContext.getAccessibleChildrenCount()

getLocale

public Locale getLocale()
Returns the locale setting for this accessible table cell.

Specified by:
getLocale in class AccessibleContext
Returns:
the locale setting for this accessible table cell

getAccessibleContext

public AccessibleContext getAccessibleContext()
Returns the accessible context of this table cell. Since accessible table cells are their own accessible context, we return this.

Specified by:
getAccessibleContext in interface Accessible
Returns:
the accessible context of this table cell

getBackground

public Color getBackground()
Returns the background color of this cell.

Specified by:
getBackground in interface AccessibleComponent
Returns:
the background color of this cell
See Also:
AccessibleComponent.setBackground(Color)

setBackground

public void setBackground(Color color)
Sets the background of the cell. Since table cells cannot have individual background colors, this method does nothing. Set the background directly on the table instead.

Specified by:
setBackground in interface AccessibleComponent
Parameters:
color - not used
See Also:
AccessibleComponent.getBackground()

getForeground

public Color getForeground()
Returns the foreground color of the table cell.

Specified by:
getForeground in interface AccessibleComponent
Returns:
the foreground color of the table cell
See Also:
AccessibleComponent.setForeground(Color)

setForeground

public void setForeground(Color color)
Sets the foreground of the cell. Since table cells cannot have individual foreground colors, this method does nothing. Set the foreground directly on the table instead.

Specified by:
setForeground in interface AccessibleComponent
Parameters:
color - not used
See Also:
AccessibleComponent.getForeground()

getCursor

public Cursor getCursor()
Returns the cursor for this table cell.

Specified by:
getCursor in interface AccessibleComponent
Returns:
the cursor for this table cell
See Also:
AccessibleComponent.setCursor(Cursor)

setCursor

public void setCursor(Cursor cursor)
Sets the cursor of the cell. Since table cells cannot have individual cursors, this method does nothing. Set the cursor directly on the table instead.

Specified by:
setCursor in interface AccessibleComponent
Parameters:
cursor - not used
See Also:
AccessibleComponent.getCursor()

getFont

public Font getFont()
Returns the font of the table cell.

Specified by:
getFont in interface AccessibleComponent
Returns:
the font of the table cell
See Also:
AccessibleComponent.setFont(Font)

setFont

public void setFont(Font font)
Sets the font of the cell. Since table cells cannot have individual fonts, this method does nothing. Set the font directly on the table instead.

Specified by:
setFont in interface AccessibleComponent
Parameters:
font - not used
See Also:
AccessibleComponent.getFont()

getFontMetrics

public FontMetrics getFontMetrics(Font font)
Returns the font metrics for a specified font.

Specified by:
getFontMetrics in interface AccessibleComponent
Parameters:
font - the font for which we return the metrics
Returns:
the font metrics for a specified font
See Also:
AccessibleComponent.getFont()

isEnabled

public boolean isEnabled()
Returns true if this table cell is enabled, false otherwise.

Specified by:
isEnabled in interface AccessibleComponent
Returns:
true if this table cell is enabled, false otherwise
See Also:
AccessibleComponent.setEnabled(boolean), AccessibleContext.getAccessibleStateSet(), AccessibleState.ENABLED

setEnabled

public void setEnabled(boolean b)
Table cells cannot be disabled or enabled individually, so this method does nothing. Set the enabled flag on the table itself.

Specified by:
setEnabled in interface AccessibleComponent
Parameters:
b - not used here
See Also:
AccessibleComponent.isEnabled()

isVisible

public boolean isVisible()
Returns true if this cell is visible, false otherwise.

Specified by:
isVisible in interface AccessibleComponent
Returns:
true if this cell is visible, false otherwise
See Also:
AccessibleComponent.setVisible(boolean), AccessibleContext.getAccessibleStateSet(), AccessibleState.VISIBLE

setVisible

public void setVisible(boolean b)
The visibility cannot be set on individual table cells, so this method does nothing. Set the visibility on the table itself.

Specified by:
setVisible in interface AccessibleComponent
Parameters:
b - not used
See Also:
AccessibleComponent.isVisible()

isShowing

public boolean isShowing()
Returns true if this table cell is currently showing on screen.

Specified by:
isShowing in interface AccessibleComponent
Returns:
true if this table cell is currently showing on screen
See Also:
AccessibleComponent.isVisible(), AccessibleComponent.setVisible(boolean), AccessibleContext.getAccessibleStateSet(), AccessibleState.SHOWING

contains

public boolean contains(Point point)
Returns true if this table cell contains the location at point, false otherwise. point is interpreted as relative to the coordinate system of the table cell.

Specified by:
contains in interface AccessibleComponent
Parameters:
point - the Point to locate
Returns:
true if this table cell contains the location at point, false otherwise
See Also:
AccessibleComponent.getBounds()

getLocationOnScreen

public Point getLocationOnScreen()
Returns the screen location of the table cell.

Specified by:
getLocationOnScreen in interface AccessibleComponent
Returns:
the screen location of the table cell
See Also:
AccessibleComponent.getBounds(), AccessibleComponent.getLocation()

getLocation

public Point getLocation()
Returns the location of this cell relative to the table's bounds.

Specified by:
getLocation in interface AccessibleComponent
Returns:
the location of this cell relative to the table's bounds
See Also:
AccessibleComponent.getBounds(), AccessibleComponent.getLocationOnScreen(), AccessibleComponent.setLocation(Point)

setLocation

public void setLocation(Point point)
The location of the table cells cannot be manipulated directly, so this method does nothing.

Specified by:
setLocation in interface AccessibleComponent
Parameters:
point - not used
See Also:
AccessibleComponent.getLocation()

getBounds

public Rectangle getBounds()
Returns the bounds of the cell relative to its table.

Specified by:
getBounds in interface AccessibleComponent
Returns:
the bounds of the cell relative to its table
See Also:
AccessibleComponent.contains(Point)

setBounds

public void setBounds(Rectangle rectangle)
The bounds of the table cells cannot be manipulated directly, so this method does nothing.

Specified by:
setBounds in interface AccessibleComponent
Parameters:
rectangle - not used

getSize

public Dimension getSize()
Returns the size of the table cell.

Specified by:
getSize in interface AccessibleComponent
Returns:
the size of the table cell
See Also:
AccessibleComponent.setSize(Dimension)

setSize

public void setSize(Dimension dimension)
The size cannot be set on table cells directly, so this method does nothing.

Specified by:
setSize in interface AccessibleComponent
Parameters:
dimension - not used
See Also:
AccessibleComponent.getSize()

getAccessibleAt

public Accessible getAccessibleAt(Point point)
Table cells have no children, so we return null here.

Specified by:
getAccessibleAt in interface AccessibleComponent
Parameters:
point - the location within this component's coordinate system
Returns:
null

isFocusTraversable

public boolean isFocusTraversable()
Returns true if this table cell is focus traversable, false otherwise.

Specified by:
isFocusTraversable in interface AccessibleComponent
Returns:
true if this table cell is focus traversable, false otherwise
See Also:
AccessibleContext.getAccessibleStateSet(), AccessibleState.FOCUSABLE, AccessibleState.FOCUSED

requestFocus

public void requestFocus()
Requests that this table cell gets the keyboard focus.

Specified by:
requestFocus in interface AccessibleComponent
See Also:
AccessibleComponent.isFocusTraversable(), AccessibleState.FOCUSED

addFocusListener

public void addFocusListener(FocusListener listener)
Adds a focus listener to this cell. The focus listener is really added to the table, so there is no way to find out when an individual cell changes the focus.

Specified by:
addFocusListener in interface AccessibleComponent
Parameters:
listener - the focus listener to add
See Also:
AccessibleComponent.removeFocusListener(FocusListener)

removeFocusListener

public void removeFocusListener(FocusListener listener)
Removes a focus listener from the cell. The focus listener is really removed from the table.

Specified by:
removeFocusListener in interface AccessibleComponent
Parameters:
listener - the listener to remove
See Also:
AccessibleComponent.addFocusListener(FocusListener)