protected class

TextComponent.AccessibleAWTTextComponent

extends Component.AccessibleAWTComponent
implements TextListener AccessibleText
java.lang.Object
   ↳ javax.accessibility.AccessibleContext
     ↳ java.awt.Component.AccessibleAWTComponent
       ↳ java.awt.TextComponent.AccessibleAWTTextComponent
Known Direct Subclasses

Class Overview

This class implements accessibility support for the TextComponent class. It provides an implementation of the Java Accessibility API appropriate to text component user-interface elements.

Summary

[Expand]
Inherited Constants
From class javax.accessibility.AccessibleContext
From interface javax.accessibility.AccessibleText
[Expand]
Inherited Fields
From class java.awt.Component.AccessibleAWTComponent
From class javax.accessibility.AccessibleContext
Public Constructors
TextComponent.AccessibleAWTTextComponent()
Constructs an AccessibleAWTTextComponent.
Public Methods
AccessibleRole getAccessibleRole()
Gets the role of this object.
AccessibleStateSet getAccessibleStateSet()
Gets the state set of the TextComponent.
AccessibleText getAccessibleText()
Get the AccessibleText associated with this object.
String getAfterIndex(int part, int index)
Returns the String after a given index.
String getAtIndex(int part, int index)
Returns the String at a given index.
String getBeforeIndex(int part, int index)
Returns the String before a given index.
int getCaretPosition()
Returns the zero-based offset of the caret.
int getCharCount()
Returns the number of characters (valid indicies)
AttributeSet getCharacterAttribute(int i)
Returns the AttributeSet for a given character (at a given index).
Rectangle getCharacterBounds(int i)
Determines the bounding box of the character at the given index into the string.
int getIndexAtPoint(Point p)
Given a point in local coordinates, return the zero-based index of the character under that Point.
String getSelectedText()
Returns the portion of the text that is selected.
int getSelectionEnd()
Returns the end offset within the selected text.
int getSelectionStart()
Returns the start offset within the selected text.
void textValueChanged(TextEvent textEvent)
TextListener notification of a text value change.
[Expand]
Inherited Methods
From class java.awt.Component.AccessibleAWTComponent
From class javax.accessibility.AccessibleContext
From class java.lang.Object
From interface java.awt.event.TextListener
From interface javax.accessibility.AccessibleComponent
From interface javax.accessibility.AccessibleText

Public Constructors

public TextComponent.AccessibleAWTTextComponent ()

Constructs an AccessibleAWTTextComponent. Adds a listener to track caret change.

Public Methods

public AccessibleRole getAccessibleRole ()

Gets the role of this object.

Returns
  • an instance of AccessibleRole describing the role of the object (AccessibleRole.TEXT)
See Also

public AccessibleStateSet getAccessibleStateSet ()

Gets the state set of the TextComponent. The AccessibleStateSet of an object is composed of a set of unique AccessibleStates. A change in the AccessibleStateSet of an object will cause a PropertyChangeEvent to be fired for the AccessibleContext.ACCESSIBLE_STATE_PROPERTY property.

Returns
  • an instance of AccessibleStateSet containing the current state set of the object

public AccessibleText getAccessibleText ()

Get the AccessibleText associated with this object. In the implementation of the Java Accessibility API for this class, return this object, which is responsible for implementing the AccessibleText interface on behalf of itself.

Returns
  • this object

public String getAfterIndex (int part, int index)

Returns the String after a given index.

Parameters
part the AccessibleText.CHARACTER, AccessibleText.WORD, or AccessibleText.SENTENCE to retrieve
index an index within the text >= 0
Returns
  • the letter, word, or sentence, null for an invalid index or part

public String getAtIndex (int part, int index)

Returns the String at a given index.

Parameters
part the AccessibleText.CHARACTER, AccessibleText.WORD, or AccessibleText.SENTENCE to retrieve
index an index within the text >= 0
Returns
  • the letter, word, or sentence, null for an invalid index or part

public String getBeforeIndex (int part, int index)

Returns the String before a given index.

Parameters
part the AccessibleText.CHARACTER, AccessibleText.WORD, or AccessibleText.SENTENCE to retrieve
index an index within the text >= 0
Returns
  • the letter, word, or sentence, null for an invalid index or part

public int getCaretPosition ()

Returns the zero-based offset of the caret. Note: The character to the right of the caret will have the same index value as the offset (the caret is between two characters).

Returns
  • the zero-based offset of the caret.

public int getCharCount ()

Returns the number of characters (valid indicies)

Returns
  • the number of characters >= 0

public AttributeSet getCharacterAttribute (int i)

Returns the AttributeSet for a given character (at a given index).

Parameters
i the zero-based index into the text
Returns
  • the AttributeSet of the character

public Rectangle getCharacterBounds (int i)

Determines the bounding box of the character at the given index into the string. The bounds are returned in local coordinates. If the index is invalid a null rectangle is returned.

Parameters
i the index into the String >= 0
Returns
  • the screen coordinates of the character's bounding box

public int getIndexAtPoint (Point p)

Given a point in local coordinates, return the zero-based index of the character under that Point. If the point is invalid, this method returns -1.

Parameters
p the Point in local coordinates
Returns
  • the zero-based index of the character under Point p.

public String getSelectedText ()

Returns the portion of the text that is selected.

Returns
  • the text, null if no selection

public int getSelectionEnd ()

Returns the end offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same. Return 0 if the text is empty, or the caret position if no selection.

Returns
  • the index into teh text of the end of the selection >= 0

public int getSelectionStart ()

Returns the start offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same. Return 0 if the text is empty, or the caret position if no selection.

Returns
  • the index into the text of the start of the selection >= 0

public void textValueChanged (TextEvent textEvent)

TextListener notification of a text value change.