java.awt

Class Component.AccessibleAWTComponent

Enclosing Class:
Component
Implemented Interfaces:
AccessibleComponent, Serializable
Known Direct Subclasses:
Box.Filler.AccessibleBoxFiller, Button.AccessibleAWTButton, Canvas.AccessibleAWTCanvas, Checkbox.AccessibleAWTCheckbox, Choice.AccessibleAWTChoice, Container.AccessibleAWTContainer, Label.AccessibleAWTLabel, List.AccessibleAWTList, List.AccessibleAWTList.AccessibleAWTListChild, Scrollbar.AccessibleAWTScrollBar, TextComponent.AccessibleAWTTextComponent

protected abstract class Component.AccessibleAWTComponent
extends AccessibleContext
implements Serializable, AccessibleComponent

This class provides accessibility support for subclasses of container.

Since:
1.3

See Also:
Serialized Form

Nested Class Summary

protected class
Component.AccessibleAWTComponent.AccessibleAWTComponentHandler
Converts component changes into property changes.
protected class
Component.AccessibleAWTComponent.AccessibleAWTFocusHandler
Converts focus changes into property changes.

Field Summary

protected ComponentListener
accessibleAWTComponentHandler
Converts show/hide events to PropertyChange events, and is registered as a component listener on this component.
protected FocusListener
accessibleAWTFocusHandler
Converts focus events to PropertyChange events, and is registered as a focus listener on this component.

Fields inherited from class javax.accessibility.AccessibleContext

ACCESSIBLE_ACTION_PROPERTY, ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY, ACCESSIBLE_CARET_PROPERTY, ACCESSIBLE_CHILD_PROPERTY, ACCESSIBLE_DESCRIPTION_PROPERTY, ACCESSIBLE_HYPERTEXT_OFFSET, 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_PROPERTY, ACCESSIBLE_VALUE_PROPERTY, ACCESSIBLE_VISIBLE_DATA_PROPERTY, accessibleDescription, accessibleName, accessibleParent

Constructor Summary

AccessibleAWTComponent()
The default constructor.

Method Summary

void
addFocusListener(FocusListener l)
Adds a focus listener.
void
addPropertyChangeListener(PropertyChangeListener l)
Adds a global property change listener to the accessible component.
boolean
contains(Point p)
Tests if the point is contained in this component.
Accessible
getAccessibleAt(Point p)
Returns the Accessible child at a point relative to the coordinate system of this component, if one exists, or null.
Accessible
getAccessibleChild(int i)
Returns the ith accessible child.
int
getAccessibleChildrenCount()
Returns the number of children of this component which implement Accessible.
AccessibleComponent
getAccessibleComponent()
Returns this, since it is an accessible component.
String
getAccessibleDescription()
Returns a brief description of this accessible context.
int
getAccessibleIndexInParent()
Returns the index of this component in its accessible parent.
String
getAccessibleName()
Returns the accessible name of this component.
Accessible
getAccessibleParent()
Returns the parent of this component, if it is accessible.
AccessibleRole
getAccessibleRole()
Returns the role of this component.
AccessibleStateSet
getAccessibleStateSet()
Returns a state set describing this component's state.
Color
getBackground()
Gets the background color.
Rectangle
getBounds()
Gets the bounds of this component, or null if it is not on screen.
Cursor
getCursor()
Gets the cursor.
Font
getFont()
Gets the font.
FontMetrics
getFontMetrics(Font f)
Gets the font metrics for a font.
Color
getForeground()
Gets the foreground color.
Locale
getLocale()
Returns the locale of this component.
Point
getLocation()
Returns the location of this object relative to its parent's coordinate system, or null if it is not showing.
Point
getLocationOnScreen()
Returns the location of this object on the screen, or null if it is not showing.
Dimension
getSize()
Gets the size of this component, or null if it is not showing.
boolean
isEnabled()
Tests if the component is enabled.
boolean
isFocusTraversable()
Tests whether this component can accept focus.
boolean
isShowing()
Tests if the component is showing.
boolean
isVisible()
Test whether the component is visible (not necesarily showing).
void
removeFocusListener(FocusListener l)
Removes a focus listener.
void
removePropertyChangeListener(PropertyChangeListener l)
Removes a global property change listener from this accessible component.
void
requestFocus()
Requests focus for this component.
void
setBackground(Color c)
Sets the background color.
void
setBounds(Rectangle r)
Sets the bounds of this component.
void
setCursor(Cursor cursor)
Sets the cursor.
void
setEnabled(boolean b)
Set whether the component is enabled.
void
setFont(Font f)
Sets the font.
void
setForeground(Color c)
Sets the foreground color.
void
setLocation(Point p)
Sets the location of this relative to its parent's coordinate system.
void
setSize(Dimension d)
Sets the size of this component.
void
setVisible(boolean b)
Sets the visibility of this component.

Methods inherited from class javax.accessibility.AccessibleContext

addPropertyChangeListener, firePropertyChange, getAccessibleAction, getAccessibleChild, getAccessibleChildrenCount, getAccessibleComponent, getAccessibleDescription, getAccessibleEditableText, getAccessibleIcon, getAccessibleIndexInParent, getAccessibleName, getAccessibleParent, getAccessibleRelationSet, getAccessibleRole, getAccessibleSelection, getAccessibleStateSet, getAccessibleTable, getAccessibleText, getAccessibleValue, getLocale, removePropertyChangeListener, setAccessibleDescription, setAccessibleName, setAccessibleParent

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

accessibleAWTComponentHandler

protected ComponentListener accessibleAWTComponentHandler
Converts show/hide events to PropertyChange events, and is registered as a component listener on this component.


accessibleAWTFocusHandler

protected FocusListener accessibleAWTFocusHandler
Converts focus events to PropertyChange events, and is registered as a focus listener on this component.

Constructor Details

AccessibleAWTComponent

protected AccessibleAWTComponent()
The default constructor.

Method Details

addFocusListener

public void addFocusListener(FocusListener l)
Adds a focus listener.
Specified by:
addFocusListener in interface AccessibleComponent

Parameters:
l - the listener to add


addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Adds a global property change listener to the accessible component.
Overrides:
addPropertyChangeListener in interface AccessibleContext

Parameters:
l - the listener to add

See Also:
Component.AccessibleAWTComponent, Component.AccessibleAWTComponent, Component.AccessibleAWTComponent, Component.AccessibleAWTComponent, Component.AccessibleAWTComponent, Component.AccessibleAWTComponent, Component.AccessibleAWTComponent


contains

public boolean contains(Point p)
Tests if the point is contained in this component.
Specified by:
contains in interface AccessibleComponent

Parameters:
p - the point to check

Returns:
true if it is contained

Throws:
NullPointerException - if p is null


getAccessibleAt

public Accessible getAccessibleAt(Point p)
Returns the Accessible child at a point relative to the coordinate system of this component, if one exists, or null. Since components have no children, subclasses must override this to get anything besides null.
Specified by:
getAccessibleAt in interface AccessibleComponent

Parameters:
p - the point to check

Returns:
the accessible child at that point

Throws:
NullPointerException - if p is null


getAccessibleChild

public Accessible getAccessibleChild(int i)
Returns the ith accessible child. Subclasses must override this if they can have children.
Overrides:
getAccessibleChild in interface AccessibleContext

Returns:
the ith accessible child, or null

See Also:
getAccessibleChildrenCount()


getAccessibleChildrenCount

public int getAccessibleChildrenCount()
Returns the number of children of this component which implement Accessible. Subclasses must override this if they can have children.
Overrides:
getAccessibleChildrenCount in interface AccessibleContext

Returns:
the number of accessible children, default 0


getAccessibleComponent

public AccessibleComponent getAccessibleComponent()
Returns this, since it is an accessible component.
Overrides:
getAccessibleComponent in interface AccessibleContext

Returns:
the accessible component


getAccessibleDescription

public String getAccessibleDescription()
Returns a brief description of this accessible context. This should be localized.
Overrides:
getAccessibleDescription in interface AccessibleContext

Returns:
a description of this component

See Also:
setAccessibleDescription(String)


getAccessibleIndexInParent

public int getAccessibleIndexInParent()
Returns the index of this component in its accessible parent.
Overrides:
getAccessibleIndexInParent in interface AccessibleContext

Returns:
the index, or -1 if the parent is not accessible

See Also:
getAccessibleParent()


getAccessibleName

public String getAccessibleName()
Returns the accessible name of this component. It is almost always wrong to return getName(), since it is not localized. In fact, for things like buttons, this should be the text of the button, not the name of the object. The tooltip text might also be appropriate.
Overrides:
getAccessibleName in interface AccessibleContext

Returns:
the name

See Also:
setAccessibleName(String)


getAccessibleParent

public Accessible getAccessibleParent()
Returns the parent of this component, if it is accessible.
Overrides:
getAccessibleParent in interface AccessibleContext

Returns:
the accessible parent


getAccessibleRole

public AccessibleRole getAccessibleRole()
Returns the role of this component.
Overrides:
getAccessibleRole in interface AccessibleContext

Returns:
the accessible role


getAccessibleStateSet

public AccessibleStateSet getAccessibleStateSet()
Returns a state set describing this component's state.
Overrides:
getAccessibleStateSet in interface AccessibleContext

Returns:
a new state set

See Also:
AccessibleState


getBackground

public Color getBackground()
Gets the background color.
Specified by:
getBackground in interface AccessibleComponent

Returns:
the background color

See Also:
setBackground(Color)


getBounds

public Rectangle getBounds()
Gets the bounds of this component, or null if it is not on screen.
Specified by:
getBounds in interface AccessibleComponent

Returns:
the bounds

See Also:
contains(Point), setBounds(Rectangle)


getCursor

public Cursor getCursor()
Gets the cursor.
Specified by:
getCursor in interface AccessibleComponent

Returns:
the cursor

See Also:
setCursor(Cursor)


getFont

public Font getFont()
Gets the font.
Specified by:
getFont in interface AccessibleComponent

Returns:
the font

See Also:
setFont(Font)


getFontMetrics

public FontMetrics getFontMetrics(Font f)
Gets the font metrics for a font.
Specified by:
getFontMetrics in interface AccessibleComponent

Parameters:
f - the font to look up

Returns:
its metrics

Throws:
NullPointerException - if f is null

See Also:
getFont()


getForeground

public Color getForeground()
Gets the foreground color.
Specified by:
getForeground in interface AccessibleComponent

Returns:
the foreground color

See Also:
setForeground(Color)


getLocale

public Locale getLocale()
Returns the locale of this component.
Overrides:
getLocale in interface AccessibleContext

Returns:
the locale

Throws:
IllegalComponentStateException - if the locale is unknown


getLocation

public Point getLocation()
Returns the location of this object relative to its parent's coordinate system, or null if it is not showing.
Specified by:
getLocation in interface AccessibleComponent

Returns:
the location

See Also:
getBounds(), getLocationOnScreen()


getLocationOnScreen

public Point getLocationOnScreen()
Returns the location of this object on the screen, or null if it is not showing.
Specified by:
getLocationOnScreen in interface AccessibleComponent

Returns:
the location relative to screen coordinates, if showing

See Also:
getBounds(), getLocation()


getSize

public Dimension getSize()
Gets the size of this component, or null if it is not showing.
Specified by:
getSize in interface AccessibleComponent

Returns:
the size

See Also:
setSize(Dimension)


isEnabled

public boolean isEnabled()
Tests if the component is enabled.
Specified by:
isEnabled in interface AccessibleComponent

Returns:
true if the component is enabled

See Also:
setEnabled(boolean), getAccessibleStateSet(), AccessibleState.ENABLED


isFocusTraversable

public boolean isFocusTraversable()
Tests whether this component can accept focus.
Specified by:
isFocusTraversable in interface AccessibleComponent

Returns:
true if this is focus traversable

See Also:
(), AccessibleState.FOCUSABLE, AccessibleState.FOCUSED


isShowing

public boolean isShowing()
Tests if the component is showing.
Specified by:
isShowing in interface AccessibleComponent

Returns:
true if this is showing


isVisible

public boolean isVisible()
Test whether the component is visible (not necesarily showing).
Specified by:
isVisible in interface AccessibleComponent

Returns:
true if it is visible

See Also:
setVisible(boolean), getAccessibleStateSet(), AccessibleState.VISIBLE


removeFocusListener

public void removeFocusListener(FocusListener l)
Removes a focus listener.
Specified by:
removeFocusListener in interface AccessibleComponent

Parameters:
l - the listener to remove


removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Removes a global property change listener from this accessible component.
Overrides:
removePropertyChangeListener in interface AccessibleContext

Parameters:
l - the listener to remove


requestFocus

public void requestFocus()
Requests focus for this component.
Specified by:
requestFocus in interface AccessibleComponent

See Also:
()


setBackground

public void setBackground(Color c)
Sets the background color.
Specified by:
setBackground in interface AccessibleComponent

Parameters:
c - the background color

See Also:
getBackground(), isOpaque()


setBounds

public void setBounds(Rectangle r)
Sets the bounds of this component.
Specified by:
setBounds in interface AccessibleComponent

Parameters:
r - the bounds

Throws:
NullPointerException - if r is null

See Also:
getBounds()


setCursor

public void setCursor(Cursor cursor)
Sets the cursor.
Specified by:
setCursor in interface AccessibleComponent

Parameters:
cursor - the cursor

See Also:
getCursor()


setEnabled

public void setEnabled(boolean b)
Set whether the component is enabled.
Specified by:
setEnabled in interface AccessibleComponent

Parameters:
b - the new enabled status

See Also:
isEnabled()


setFont

public void setFont(Font f)
Sets the font.
Specified by:
setFont in interface AccessibleComponent

Parameters:
f - the font

See Also:
getFont()


setForeground

public void setForeground(Color c)
Sets the foreground color.
Specified by:
setForeground in interface AccessibleComponent

Parameters:
c - the foreground color

See Also:
getForeground()


setLocation

public void setLocation(Point p)
Sets the location of this relative to its parent's coordinate system.
Specified by:
setLocation in interface AccessibleComponent

Parameters:
p - the location

Throws:
NullPointerException - if p is null

See Also:
getLocation()


setSize

public void setSize(Dimension d)
Sets the size of this component.
Specified by:
setSize in interface AccessibleComponent

Parameters:
d - the size

Throws:
NullPointerException - if d is null

See Also:
getSize()


setVisible

public void setVisible(boolean b)
Sets the visibility of this component.
Specified by:
setVisible in interface AccessibleComponent

Parameters:
b - the desired visibility

See Also:
isVisible()


Component.java -- a graphics component Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.