javax.swing
Class JList.AccessibleJList.AccessibleJListChild

java.lang.Object
  extended by javax.accessibility.AccessibleContext
      extended by javax.swing.JList.AccessibleJList.AccessibleJListChild
All Implemented Interfaces:
Accessible, AccessibleComponent
Enclosing class:
JList.AccessibleJList

protected class JList.AccessibleJList.AccessibleJListChild
extends AccessibleContext
implements Accessible, AccessibleComponent

Provides accessibility support for list elements in JLists.


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
JList.AccessibleJList.AccessibleJListChild(JList list, int index)
          Creates a new instance of AccessibleJListChild.
 
Method Summary
 void addFocusListener(FocusListener listener)
          Adds a focus listener to the parent list.
 void addPropertyChangeListener(PropertyChangeListener l)
          This method does nothing, list children are transient accessible objects which means that they don't fire property change events.
 boolean contains(Point point)
          Returns true if this list child covers the screen location point (relative to the JList coordinate system, false otherwise.
 Accessible getAccessibleAt(Point point)
          Returns null because list children do not have children themselves
 Accessible getAccessibleChild(int i)
          Returns null since list children don't have children themselves.
 int getAccessibleChildrenCount()
          Returns 0 since list children don't have children themselves.
 AccessibleContext getAccessibleContext()
          Returns the accessible context of this object.
 int getAccessibleIndexInParent()
          Returns the index of this list child within it's parent list.
 AccessibleRole getAccessibleRole()
          Returns the accessible role of this list item, which is AccessibleRole.LABEL.
 AccessibleStateSet getAccessibleStateSet()
          Returns the accessible state set of this list item.
 Color getBackground()
          Returns the background color for this list child.
 Rectangle getBounds()
          Returns the bounds of this list child.
 Cursor getCursor()
          Returns the cursor for this list child.
 Font getFont()
          Returns the font of the JList since it is not possible to set fonts for list children individually.
 FontMetrics getFontMetrics(Font font)
          Returns the font metrics for the specified font.
 Color getForeground()
          Returns the foreground color for this list child.
 Locale getLocale()
          Returns the locale of this component.
 Point getLocation()
          Returns the screen location of this list child relative to it's parent.
 Point getLocationOnScreen()
          Returns the absolute screen location of this list child.
 Dimension getSize()
          Returns the size of this list child.
 boolean isEnabled()
          Returns true if the parent JList is enabled, false otherwise.
 boolean isFocusTraversable()
          Returns true since list children are focus traversable.
 boolean isShowing()
          Returns true if this list child is currently showing on screen and false otherwise.
 boolean isVisible()
          Returns true if this list child is visible, false otherwise.
 void removeFocusListener(FocusListener listener)
          Removes a focus listener from the parent list.
 void removePropertyChangeListener(PropertyChangeListener l)
          This method does nothing, list children are transient accessible objects which means that they don't fire property change events.
 void requestFocus()
          Requests focus on the parent list.
 void setBackground(Color color)
          Calling this method has no effect, since the background color cannot be set on list children individually.
 void setBounds(Rectangle rectangle)
          Does nothing since the bounds cannot be set on list children individually.
 void setCursor(Cursor cursor)
          Sets the cursor for this list child.
 void setEnabled(boolean b)
          Does nothing since the enabled flag cannot be set for list children individually.
 void setFont(Font font)
          Does nothing since it is not possible to set the font on list children individually.
 void setForeground(Color color)
          Calling this method has no effect, since the foreground color cannot be set on list children individually.
 void setLocation(Point point)
          Does nothing since the screen location cannot be set on list children explictitly.
 void setSize(Dimension dimension)
          Does nothing since the size cannot be set on list children individually.
 void setVisible(boolean b)
          The value of the visible property cannot be modified, so this method does nothing.
 
Methods inherited from class javax.accessibility.AccessibleContext
firePropertyChange, getAccessibleAction, getAccessibleComponent, getAccessibleDescription, getAccessibleEditableText, getAccessibleIcon, getAccessibleName, getAccessibleParent, getAccessibleRelationSet, getAccessibleSelection, getAccessibleTable, getAccessibleText, getAccessibleValue, setAccessibleDescription, setAccessibleName, setAccessibleParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JList.AccessibleJList.AccessibleJListChild

public JList.AccessibleJList.AccessibleJListChild(JList list,
                                                  int index)
Creates a new instance of AccessibleJListChild.

Parameters:
list - the list of which this is an accessible child
index - the list index for this child
Method Detail

getAccessibleContext

public AccessibleContext getAccessibleContext()
Returns the accessible context of this object. Returns this since AccessibleJListChilds are their own accessible contexts.

Specified by:
getAccessibleContext in interface Accessible
Returns:
the accessible context of this object, this

getBackground

public Color getBackground()
Returns the background color for this list child. This returns the background of the JList itself since the background cannot be set on list children individually

Specified by:
getBackground in interface AccessibleComponent
Returns:
the background color for this list child
See Also:
AccessibleComponent.setBackground(Color)

setBackground

public void setBackground(Color color)
Calling this method has no effect, since the background color cannot be set on list children individually.

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

getForeground

public Color getForeground()
Returns the foreground color for this list child. This returns the background of the JList itself since the foreground cannot be set on list children individually.

Specified by:
getForeground in interface AccessibleComponent
Returns:
the background color for this list child
See Also:
AccessibleComponent.setForeground(Color)

setForeground

public void setForeground(Color color)
Calling this method has no effect, since the foreground color cannot be set on list children individually.

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

getCursor

public Cursor getCursor()
Returns the cursor for this list child.

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

setCursor

public void setCursor(Cursor cursor)
Sets the cursor for this list child.

Specified by:
setCursor in interface AccessibleComponent
Parameters:
cursor - the graphical representation of the cursor to use
See Also:
AccessibleComponent.getCursor()

getFont

public Font getFont()
Returns the font of the JList since it is not possible to set fonts for list children individually.

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

setFont

public void setFont(Font font)
Does nothing since it is not possible to set the font on list children individually.

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

getFontMetrics

public FontMetrics getFontMetrics(Font font)
Returns the font metrics for the specified font. This method forwards to the parent JList.

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

isEnabled

public boolean isEnabled()
Returns true if the parent JList is enabled, false otherwise. The list children cannot have an enabled flag set individually.

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

setEnabled

public void setEnabled(boolean b)
Does nothing since the enabled flag cannot be set for list children individually.

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

isVisible

public boolean isVisible()
Returns true if this list child is visible, false otherwise. The value of this property depends on JList.getFirstVisibleIndex() and JList.getLastVisibleIndex().

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

setVisible

public void setVisible(boolean b)
The value of the visible property cannot be modified, so this method does nothing.

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

isShowing

public boolean isShowing()
Returns true if this list child is currently showing on screen and false otherwise. The list child is showing if it is visible and if it's parent JList is currently showing.

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

contains

public boolean contains(Point point)
Returns true if this list child covers the screen location point (relative to the JList coordinate system, false otherwise.

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

getLocationOnScreen

public Point getLocationOnScreen()
Returns the absolute screen location of this list child.

Specified by:
getLocationOnScreen in interface AccessibleComponent
Returns:
the absolute screen location of this list child
See Also:
AccessibleComponent.getBounds(), AccessibleComponent.getLocation()

getLocation

public Point getLocation()
Returns the screen location of this list child relative to it's parent.

Specified by:
getLocation in interface AccessibleComponent
Returns:
the location of this list child relative to it's parent
See Also:
JList.indexToLocation(int)

setLocation

public void setLocation(Point point)
Does nothing since the screen location cannot be set on list children explictitly.

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

getBounds

public Rectangle getBounds()
Returns the bounds of this list child.

Specified by:
getBounds in interface AccessibleComponent
Returns:
the bounds of this list child
See Also:
JList.getCellBounds(int, int)

setBounds

public void setBounds(Rectangle rectangle)
Does nothing since the bounds cannot be set on list children individually.

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

getSize

public Dimension getSize()
Returns the size of this list child.

Specified by:
getSize in interface AccessibleComponent
Returns:
the size of this list child
See Also:
AccessibleComponent.setSize(Dimension)

setSize

public void setSize(Dimension dimension)
Does nothing since the size cannot be set on list children individually.

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

getAccessibleAt

public Accessible getAccessibleAt(Point point)
Returns null because list children do not have children themselves

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

isFocusTraversable

public boolean isFocusTraversable()
Returns true since list children are focus traversable.

Specified by:
isFocusTraversable in interface AccessibleComponent
Returns:
true
See Also:
AccessibleContext.getAccessibleStateSet(), AccessibleState.FOCUSABLE, AccessibleState.FOCUSED

requestFocus

public void requestFocus()
Requests focus on the parent list. List children cannot request focus individually.

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

addFocusListener

public void addFocusListener(FocusListener listener)
Adds a focus listener to the parent list. List children do not have their own focus management.

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 parent list. List children do not have their own focus management.

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

getAccessibleRole

public AccessibleRole getAccessibleRole()
Returns the accessible role of this list item, which is AccessibleRole.LABEL.

Specified by:
getAccessibleRole in class AccessibleContext
Returns:
AccessibleRole.LABEL
See Also:
AccessibleRole

getAccessibleStateSet

public AccessibleStateSet getAccessibleStateSet()
Returns the accessible state set of this list item.

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

getAccessibleIndexInParent

public int getAccessibleIndexInParent()
Returns the index of this list child within it's parent list.

Specified by:
getAccessibleIndexInParent in class AccessibleContext
Returns:
the index of this list child within it's parent list
See Also:
AccessibleContext.getAccessibleParent(), AccessibleContext.getAccessibleChildrenCount(), AccessibleContext.getAccessibleChild(int)

getAccessibleChildrenCount

public int getAccessibleChildrenCount()
Returns 0 since list children don't have children themselves.

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

getAccessibleChild

public Accessible getAccessibleChild(int i)
Returns null since list children don't have children themselves.

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 of this component. This call is forwarded to the parent list since list children don't have a separate locale setting.

Specified by:
getLocale in class AccessibleContext
Returns:
the locale of this component

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
This method does nothing, list children are transient accessible objects which means that they don't fire property change events.

Overrides:
addPropertyChangeListener in class AccessibleContext
Parameters:
l - not used here
See Also:
AccessibleContext.ACCESSIBLE_NAME_PROPERTY, AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, AccessibleContext.ACCESSIBLE_STATE_PROPERTY, AccessibleContext.ACCESSIBLE_VALUE_PROPERTY, AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, AccessibleContext.ACCESSIBLE_TEXT_PROPERTY, AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, AccessibleContext.removePropertyChangeListener(PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
This method does nothing, list children are transient accessible objects which means that they don't fire property change events.

Overrides:
removePropertyChangeListener in class AccessibleContext
Parameters:
l - not used here
See Also:
AccessibleContext.addPropertyChangeListener(PropertyChangeListener)