APIdia Launch Partner
Top Description Methods
javax.accessibility

public Interface AccessibleComponent

Known Direct Subinterfaces
javax.accessibility.AccessibleExtendedComponent
Known Direct Implementers
javax.swing.JList.AccessibleJList.AccessibleJListChild, javax.swing.JTabbedPane.Page, javax.swing.JTable.AccessibleJTable.AccessibleJTableCell, javax.swing.JTable.AccessibleJTable.AccessibleJTableHeaderCell, javax.swing.JTree.AccessibleJTree.AccessibleJTreeNode, javax.swing.table.JTableHeader.AccessibleJTableHeader.AccessibleJTableHeaderEntry, javax.swing.text.html.AccessibleHTML.HTMLAccessibleContext, java.awt.Component.AccessibleAWTComponent, java.awt.MenuComponent.AccessibleAWTMenuComponent
Imports
java.awt.Color, .Cursor, .Dimension, .Font, .FontMetrics, .Point, .Rectangle, java.awt.event.FocusListener

The AccessibleComponent interface should be supported by any object that is rendered on the screen. This interface provides the standard mechanism for an assistive technology to determine and set the graphical representation of an object. Applications can determine if an object supports the AccessibleComponent interface by first obtaining its AccessibleContext and then calling the AccessibleContext#getAccessibleComponent method. If the return value is not null, the object supports this interface.
Authors
Peter Korn, Hans Muller, Willie Walker
See Also
Accessible, Accessible#getAccessibleContext, AccessibleContext, AccessibleContext#getAccessibleComponent

Method Summary

Modifier and TypeMethod and Description
public void
addFocusListener(FocusListener
the focus listener
l
)

Adds the specified focus listener to receive focus events from this component.

public boolean

Returns:

true if object contains point; otherwise false
contains
(Point
the point relative to the coordinate system of the object
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 Accessible

Returns:

the Accessible, if it exists, at the specified location; otherwise null
getAccessibleAt
(Point
The point relative to the coordinate system of this object
p
)

Returns the Accessible child, if one exists, contained at the local coordinate Point.

public Color

Returns:

the background color, if supported, of the object; otherwise, null
getBackground
()

Gets the background color of this object.

public Rectangle

Returns:

A rectangle indicating this component's bounds; null if this object is not on the screen.
getBounds
()

Gets the bounds of this object in the form of a Rectangle object.

public Cursor

Returns:

the cursor, if supported, of the object; otherwise, null
getCursor
()

Gets the cursor of this object.

public Font

Returns:

the font, if supported, for the object; otherwise, null
getFont
()

Gets the font of this object.

public FontMetrics

Returns:

the FontMetrics, if supported, the object; otherwise, null
getFontMetrics
(Font
the font for which font metrics is to be obtained
f
)

Gets the FontMetrics of this object.

public Color

Returns:

the foreground color, if supported, of the object; otherwise, null
getForeground
()

Gets the foreground color of this object.

public Point

Returns:

An instance of Point representing the top-left corner of the object's bounds in the coordinate space of the screen; null if this object or its parent are not on the screen
getLocation
()

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

Returns:

the location of the object on screen; null if this object is not on the screen
getLocationOnScreen
()

Returns the location of the object on the screen.

public Dimension

Returns:

A Dimension object that indicates the size of this component; null if this object is not on the screen
getSize
()

Returns the size of this object in the form of a Dimension object.

public boolean

Returns:

true if object is enabled; otherwise, false
isEnabled
()

Determines if the object is enabled.

public boolean

Returns:

true if object can accept focus; otherwise false
isFocusTraversable
()

Returns whether this object can accept focus or not.

public boolean

Returns:

true if object is showing; otherwise, false
isShowing
()

Determines if the object is showing.

public boolean

Returns:

true if object is visible; otherwise, false
isVisible
()

Determines if the object is visible.

public void
removeFocusListener(FocusListener
the focus listener
l
)

Removes the specified focus listener so it no longer receives focus events from this component.

public void
requestFocus()

Requests focus for this object.

public void
setBackground(Color
the new color for the background
c
)

Sets the background color of this object.

public void
setBounds(Rectangle
rectangle indicating this component's bounds
r
)

Sets the bounds of this object in the form of a Rectangle object.

public void
setCursor(Cursor
the new cursor for the object
cursor
)

Sets the cursor of this object.

public void
setEnabled(boolean
if true, enables this object; otherwise, disables it
b
)

Sets the enabled state of the object.

public void
setFont(Font
the new font for the object
f
)

Sets the font of this object.

public void
setForeground(Color
the new color for the foreground
c
)

Sets the foreground color of this object.

public void
setLocation(Point
the new position for the top-left corner
p
)

Sets the location of the object relative to the parent.

public void
setSize(Dimension
The dimension specifying the new size of the object
d
)

Resizes this object so that it has width and height.

public void
setVisible(boolean
if true, shows this object; otherwise, hides it
b
)

Sets the visible state of the object.

Method Detail

addFocusListenerback to summary
public void addFocusListener(FocusListener l)

Adds the specified focus listener to receive focus events from this component.

Parameters
l:FocusListener

the focus listener

See Also
removeFocusListener
containsback to summary
public boolean contains(Point 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.

Parameters
p:Point

the point relative to the coordinate system of the object

Returns:boolean

true if object contains point; otherwise false

See Also
getBounds
getAccessibleAtback to summary
public Accessible getAccessibleAt(Point p)

Returns the Accessible child, if one exists, contained at the local coordinate Point.

Parameters
p:Point

The point relative to the coordinate system of this object

Returns:Accessible

the Accessible, if it exists, at the specified location; otherwise null

getBackgroundback to summary
public Color getBackground()

Gets the background color of this object.

Returns:Color

the background color, if supported, of the object; otherwise, null

See Also
setBackground
getBoundsback to summary
public Rectangle getBounds()

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.

Returns:Rectangle

A rectangle indicating this component's bounds; null if this object is not on the screen.

See Also
contains
getCursorback to summary
public Cursor getCursor()

Gets the cursor of this object.

Returns:Cursor

the cursor, if supported, of the object; otherwise, null

See Also
setCursor
getFontback to summary
public Font getFont()

Gets the font of this object.

Returns:Font

the font, if supported, for the object; otherwise, null

See Also
setFont
getFontMetricsback to summary
public FontMetrics getFontMetrics(Font f)

Gets the FontMetrics of this object.

Parameters
f:Font

the font for which font metrics is to be obtained

Returns:FontMetrics

the FontMetrics, if supported, the object; otherwise, null

See Also
getFont
getForegroundback to summary
public Color getForeground()

Gets the foreground color of this object.

Returns:Color

the foreground color, if supported, of the object; otherwise, null

See Also
setForeground
getLocationback to summary
public Point getLocation()

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.

Returns:Point

An instance of Point representing the top-left corner of the object's bounds in the coordinate space of the screen; null if this object or its parent are not on the screen

See Also
getBounds, getLocationOnScreen
getLocationOnScreenback to summary
public Point getLocationOnScreen()

Returns the location of the object on the screen.

Returns:Point

the location of the object on screen; null if this object is not on the screen

See Also
getBounds, getLocation
getSizeback to summary
public Dimension getSize()

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.

Returns:Dimension

A Dimension object that indicates the size of this component; null if this object is not on the screen

See Also
setSize
isEnabledback to summary
public boolean isEnabled()

Determines if the object is enabled. Objects that are enabled will also have the AccessibleState.ENABLED state set in their AccessibleStateSets.

Returns:boolean

true if object is enabled; otherwise, false

See Also
setEnabled, AccessibleContext#getAccessibleStateSet, AccessibleState#ENABLED, AccessibleStateSet
isFocusTraversableback to summary
public boolean isFocusTraversable()

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.

Returns:boolean

true if object can accept focus; otherwise false

See Also
AccessibleContext#getAccessibleStateSet, AccessibleState#FOCUSABLE, AccessibleState#FOCUSED, AccessibleStateSet
isShowingback to summary
public boolean isShowing()

Determines if the object is showing. This is determined by checking the visibility of the object and its ancestors.

Note

this will return true even if the object is obscured by another (for example, it is underneath a menu that was pulled down).

Returns:boolean

true if object is showing; otherwise, false

isVisibleback to summary
public boolean isVisible()

Determines if the object is visible.

Note

this means that the object intends to be visible; however, it may not be showing on the screen because one of the objects that this object is contained by is currently not visible. To determine if an object is showing on the screen, use isShowing()

Objects that are visible will also have the AccessibleState.VISIBLE state set in their AccessibleStateSets.

Returns:boolean

true if object is visible; otherwise, false

See Also
setVisible, AccessibleContext#getAccessibleStateSet, AccessibleState#VISIBLE, AccessibleStateSet
removeFocusListenerback to summary
public void removeFocusListener(FocusListener l)

Removes the specified focus listener so it no longer receives focus events from this component.

Parameters
l:FocusListener

the focus listener

See Also
addFocusListener
requestFocusback to summary
public void requestFocus()

Requests focus for this object. If this object cannot accept focus, nothing will happen. Otherwise, the object will attempt to take focus.

See Also
isFocusTraversable
setBackgroundback to summary
public void setBackground(Color c)

Sets the background color of this object.

Parameters
c:Color

the new color for the background

See Also
getBackground
setBoundsback to summary
public void setBounds(Rectangle 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.

Parameters
r:Rectangle

rectangle indicating this component's bounds

See Also
getBounds
setCursorback to summary
public void setCursor(Cursor cursor)

Sets the cursor of this object.

Parameters
cursor:Cursor

the new cursor for the object

See Also
getCursor
setEnabledback to summary
public void setEnabled(boolean b)

Sets the enabled state of the object.

Parameters
b:boolean

if true, enables this object; otherwise, disables it

See Also
isEnabled
setFontback to summary
public void setFont(Font f)

Sets the font of this object.

Parameters
f:Font

the new font for the object

See Also
getFont
setForegroundback to summary
public void setForeground(Color c)

Sets the foreground color of this object.

Parameters
c:Color

the new color for the foreground

See Also
getForeground
setLocationback to summary
public void setLocation(Point p)

Sets the location of the object relative to the parent.

Parameters
p:Point

the new position for the top-left corner

See Also
getLocation
setSizeback to summary
public void setSize(Dimension d)

Resizes this object so that it has width and height.

Parameters
d:Dimension

The dimension specifying the new size of the object

See Also
getSize
setVisibleback to summary
public void setVisible(boolean b)

Sets the visible state of the object.

Parameters
b:boolean

if true, shows this object; otherwise, hides it

See Also
isVisible