java.awt

Class Component.AccessibleAWTComponent

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

This class provides accessibility support for subclasses of container.

Since: 1.3

UNKNOWN: updated to 1.4

Nested Class Summary
protected classComponent.AccessibleAWTComponent.AccessibleAWTComponentHandler
Converts component changes into property changes.
protected classComponent.AccessibleAWTComponent.AccessibleAWTFocusHandler
Converts focus changes into property changes.
Field Summary
protected ComponentListeneraccessibleAWTComponentHandler
Converts show/hide events to PropertyChange events, and is registered as a component listener on this component.
protected FocusListeneraccessibleAWTFocusHandler
Converts focus events to PropertyChange events, and is registered as a focus listener on this component.
Constructor Summary
protected AccessibleAWTComponent()
The default constructor.
Method Summary
voidaddFocusListener(FocusListener l)
Adds a focus listener.
voidaddPropertyChangeListener(PropertyChangeListener l)
Adds a global property change listener to the accessible component.
booleancontains(Point p)
Tests if the point is contained in this component.
AccessiblegetAccessibleAt(Point p)
Returns the Accessible child at a point relative to the coordinate system of this component, if one exists, or null.
AccessiblegetAccessibleChild(int i)
Returns the ith accessible child.
intgetAccessibleChildrenCount()
Returns the number of children of this component which implement Accessible.
AccessibleComponentgetAccessibleComponent()
Returns this, since it is an accessible component.
StringgetAccessibleDescription()
Returns a brief description of this accessible context.
intgetAccessibleIndexInParent()
Returns the index of this component in its accessible parent.
StringgetAccessibleName()
Returns the accessible name of this component.
AccessiblegetAccessibleParent()
Returns the parent of this component, if it is accessible.
AccessibleRolegetAccessibleRole()
Returns the role of this component.
AccessibleStateSetgetAccessibleStateSet()
Returns a state set describing this component's state.
ColorgetBackground()
Gets the background color.
RectanglegetBounds()
Gets the bounds of this component, or null if it is not on screen.
CursorgetCursor()
Gets the cursor.
FontgetFont()
Gets the font.
FontMetricsgetFontMetrics(Font f)
Gets the font metrics for a font.
ColorgetForeground()
Gets the foreground color.
LocalegetLocale()
Returns the locale of this component.
PointgetLocation()
Returns the location of this object relative to its parent's coordinate system, or null if it is not showing.
PointgetLocationOnScreen()
Returns the location of this object on the screen, or null if it is not showing.
DimensiongetSize()
Gets the size of this component, or null if it is not showing.
booleanisEnabled()
Tests if the component is enabled.
booleanisFocusTraversable()
Tests whether this component can accept focus.
booleanisShowing()
Tests if the component is showing.
booleanisVisible()
Test whether the component is visible (not necesarily showing).
voidremoveFocusListener(FocusListener l)
Removes a focus listener.
voidremovePropertyChangeListener(PropertyChangeListener l)
Removes a global property change listener from this accessible component.
voidrequestFocus()
Requests focus for this component.
voidsetBackground(Color c)
Sets the background color.
voidsetBounds(Rectangle r)
Sets the bounds of this component.
voidsetCursor(Cursor cursor)
Sets the cursor.
voidsetEnabled(boolean b)
Set whether the component is enabled.
voidsetFont(Font f)
Sets the font.
voidsetForeground(Color c)
Sets the foreground color.
voidsetLocation(Point p)
Sets the location of this relative to its parent's coordinate system.
voidsetSize(Dimension d)
Sets the size of this component.
voidsetVisible(boolean b)
Sets the visibility of this component.

Field Detail

accessibleAWTComponentHandler

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

Serial: the component handler

accessibleAWTFocusHandler

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

Serial: the focus handler

Constructor Detail

AccessibleAWTComponent

protected AccessibleAWTComponent()
The default constructor.

Method Detail

addFocusListener

public void addFocusListener(FocusListener l)
Adds a focus listener.

Parameters: l the listener to add

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Adds a global property change listener to the accessible component.

Parameters: l the listener to add

See Also: AccessibleAWTComponent AccessibleAWTComponent AccessibleAWTComponent AccessibleAWTComponent AccessibleAWTComponent AccessibleAWTComponent AccessibleAWTComponent

contains

public boolean contains(Point p)
Tests if the point is contained in this component.

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.

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.

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.

Returns: the number of accessible children, default 0

getAccessibleComponent

public AccessibleComponent getAccessibleComponent()
Returns this, since it is an accessible component.

Returns: the accessible component

getAccessibleDescription

public String getAccessibleDescription()
Returns a brief description of this accessible context. This should be localized.

Returns: a description of this component

See Also: AccessibleAWTComponent

getAccessibleIndexInParent

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

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.

Returns: the name

See Also: AccessibleAWTComponent

getAccessibleParent

public Accessible getAccessibleParent()
Returns the parent of this component, if it is accessible.

Returns: the accessible parent

getAccessibleRole

public AccessibleRole getAccessibleRole()
Returns the role of this component.

Returns: the accessible role

getAccessibleStateSet

public AccessibleStateSet getAccessibleStateSet()
Returns a state set describing this component's state.

Returns: a new state set

See Also: AccessibleState

getBackground

public Color getBackground()
Gets the background color.

Returns: the background color

See Also: setBackground

getBounds

public Rectangle getBounds()
Gets the bounds of this component, or null if it is not on screen.

Returns: the bounds

See Also: contains setBounds

getCursor

public Cursor getCursor()
Gets the cursor.

Returns: the cursor

See Also: setCursor

getFont

public Font getFont()
Gets the font.

Returns: the font

See Also: setFont

getFontMetrics

public FontMetrics getFontMetrics(Font f)
Gets the font metrics for a font.

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.

Returns: the foreground color

See Also: setForeground

getLocale

public Locale getLocale()
Returns the locale of this component.

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.

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.

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.

Returns: the size

See Also: setSize

isEnabled

public boolean isEnabled()
Tests if the component is enabled.

Returns: true if the component is enabled

See Also: AccessibleAWTComponent getAccessibleStateSet ENABLED

isFocusTraversable

public boolean isFocusTraversable()
Tests whether this component can accept focus.

Returns: true if this is focus traversable

See Also: getAccessibleStateSet FOCUSABLE FOCUSED

isShowing

public boolean isShowing()
Tests if the component is showing.

Returns: true if this is showing

isVisible

public boolean isVisible()
Test whether the component is visible (not necesarily showing).

Returns: true if it is visible

See Also: AccessibleAWTComponent getAccessibleStateSet VISIBLE

removeFocusListener

public void removeFocusListener(FocusListener l)
Removes a focus listener.

Parameters: l the listener to remove

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Removes a global property change listener from this accessible component.

Parameters: l the listener to remove

requestFocus

public void requestFocus()
Requests focus for this component.

See Also: isFocusTraversable

setBackground

public void setBackground(Color c)
Sets the background color.

Parameters: c the background color

See Also: getBackground AccessibleAWTComponent

setBounds

public void setBounds(Rectangle r)
Sets the bounds of this component.

Parameters: r the bounds

Throws: NullPointerException if r is null

See Also: getBounds

setCursor

public void setCursor(Cursor cursor)
Sets the cursor.

Parameters: cursor the cursor

See Also: getCursor

setEnabled

public void setEnabled(boolean b)
Set whether the component is enabled.

Parameters: b the new enabled status

See Also: isEnabled

setFont

public void setFont(Font f)
Sets the font.

Parameters: f the font

See Also: getFont

setForeground

public void setForeground(Color c)
Sets the foreground color.

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.

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.

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.

Parameters: b the desired visibility

See Also: isVisible