javax.accessibility
Interface AccessibleText

All Known Subinterfaces:
AccessibleEditableText sample code for javax.accessibility.AccessibleEditableText definition code for javax.accessibility.AccessibleEditableText , AccessibleHypertext sample code for javax.accessibility.AccessibleHypertext definition code for javax.accessibility.AccessibleHypertext
All Known Implementing Classes:
AbstractButton.AccessibleAbstractButton sample code for javax.swing.AbstractButton.AccessibleAbstractButton definition code for javax.swing.AbstractButton.AccessibleAbstractButton , JButton.AccessibleJButton sample code for javax.swing.JButton.AccessibleJButton definition code for javax.swing.JButton.AccessibleJButton , JCheckBox.AccessibleJCheckBox sample code for javax.swing.JCheckBox.AccessibleJCheckBox definition code for javax.swing.JCheckBox.AccessibleJCheckBox , JCheckBoxMenuItem.AccessibleJCheckBoxMenuItem sample code for javax.swing.JCheckBoxMenuItem.AccessibleJCheckBoxMenuItem definition code for javax.swing.JCheckBoxMenuItem.AccessibleJCheckBoxMenuItem , JEditorPane.AccessibleJEditorPane sample code for javax.swing.JEditorPane.AccessibleJEditorPane definition code for javax.swing.JEditorPane.AccessibleJEditorPane , JEditorPane.AccessibleJEditorPaneHTML sample code for javax.swing.JEditorPane.AccessibleJEditorPaneHTML definition code for javax.swing.JEditorPane.AccessibleJEditorPaneHTML , JEditorPane.JEditorPaneAccessibleHypertextSupport sample code for javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport definition code for javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport , JLabel.AccessibleJLabel sample code for javax.swing.JLabel.AccessibleJLabel definition code for javax.swing.JLabel.AccessibleJLabel , JMenu.AccessibleJMenu sample code for javax.swing.JMenu.AccessibleJMenu definition code for javax.swing.JMenu.AccessibleJMenu , JMenuItem.AccessibleJMenuItem sample code for javax.swing.JMenuItem.AccessibleJMenuItem definition code for javax.swing.JMenuItem.AccessibleJMenuItem , JPasswordField.AccessibleJPasswordField sample code for javax.swing.JPasswordField.AccessibleJPasswordField definition code for javax.swing.JPasswordField.AccessibleJPasswordField , JRadioButton.AccessibleJRadioButton sample code for javax.swing.JRadioButton.AccessibleJRadioButton definition code for javax.swing.JRadioButton.AccessibleJRadioButton , JRadioButtonMenuItem.AccessibleJRadioButtonMenuItem sample code for javax.swing.JRadioButtonMenuItem.AccessibleJRadioButtonMenuItem definition code for javax.swing.JRadioButtonMenuItem.AccessibleJRadioButtonMenuItem , JSpinner.AccessibleJSpinner sample code for javax.swing.JSpinner.AccessibleJSpinner definition code for javax.swing.JSpinner.AccessibleJSpinner , JTextArea.AccessibleJTextArea sample code for javax.swing.JTextArea.AccessibleJTextArea definition code for javax.swing.JTextArea.AccessibleJTextArea , JTextComponent.AccessibleJTextComponent sample code for javax.swing.text.JTextComponent.AccessibleJTextComponent definition code for javax.swing.text.JTextComponent.AccessibleJTextComponent , JTextField.AccessibleJTextField sample code for javax.swing.JTextField.AccessibleJTextField definition code for javax.swing.JTextField.AccessibleJTextField , JToggleButton.AccessibleJToggleButton sample code for javax.swing.JToggleButton.AccessibleJToggleButton definition code for javax.swing.JToggleButton.AccessibleJToggleButton , ProgressMonitor.AccessibleProgressMonitor sample code for javax.swing.ProgressMonitor.AccessibleProgressMonitor definition code for javax.swing.ProgressMonitor.AccessibleProgressMonitor , TextArea.AccessibleAWTTextArea sample code for java.awt.TextArea.AccessibleAWTTextArea definition code for java.awt.TextArea.AccessibleAWTTextArea , TextComponent.AccessibleAWTTextComponent sample code for java.awt.TextComponent.AccessibleAWTTextComponent definition code for java.awt.TextComponent.AccessibleAWTTextComponent , TextField.AccessibleAWTTextField sample code for java.awt.TextField.AccessibleAWTTextField definition code for java.awt.TextField.AccessibleAWTTextField

public interface AccessibleText

The AccessibleText interface should be implemented by all classes that present textual information on the display. This interface provides the standard mechanism for an assistive technology to access that text via its content, attributes, and spatial location. Applications can determine if an object supports the AccessibleText interface by first obtaining its AccessibleContext (see Accessible sample code for javax.accessibility.Accessible definition code for javax.accessibility.Accessible ) and then calling the AccessibleContext.getAccessibleText() sample code for javax.accessibility.AccessibleContext.getAccessibleText() definition code for javax.accessibility.AccessibleContext.getAccessibleText() method of AccessibleContext. If the return value is not null, the object supports this interface.

See Also:
Accessible sample code for javax.accessibility.Accessible definition code for javax.accessibility.Accessible , Accessible.getAccessibleContext() sample code for javax.accessibility.Accessible.getAccessibleContext() definition code for javax.accessibility.Accessible.getAccessibleContext() , AccessibleContext sample code for javax.accessibility.AccessibleContext definition code for javax.accessibility.AccessibleContext , AccessibleContext.getAccessibleText() sample code for javax.accessibility.AccessibleContext.getAccessibleText() definition code for javax.accessibility.AccessibleContext.getAccessibleText()

Field Summary
static int CHARACTER sample code for javax.accessibility.AccessibleText.CHARACTER definition code for javax.accessibility.AccessibleText.CHARACTER
          Constant used to indicate that the part of the text that should be retrieved is a character.
static int SENTENCE sample code for javax.accessibility.AccessibleText.SENTENCE definition code for javax.accessibility.AccessibleText.SENTENCE
          Constant used to indicate that the part of the text that should be retrieved is a sentence.
static int WORD sample code for javax.accessibility.AccessibleText.WORD definition code for javax.accessibility.AccessibleText.WORD
          Constant used to indicate that the part of the text that should be retrieved is a word.
 
Method Summary
 String sample code for java.lang.String definition code for java.lang.String getAfterIndex sample code for javax.accessibility.AccessibleText.getAfterIndex(int, int) definition code for javax.accessibility.AccessibleText.getAfterIndex(int, int) (int part, int index)
          Returns the String after a given index.
 String sample code for java.lang.String definition code for java.lang.String getAtIndex sample code for javax.accessibility.AccessibleText.getAtIndex(int, int) definition code for javax.accessibility.AccessibleText.getAtIndex(int, int) (int part, int index)
          Returns the String at a given index.
 String sample code for java.lang.String definition code for java.lang.String getBeforeIndex sample code for javax.accessibility.AccessibleText.getBeforeIndex(int, int) definition code for javax.accessibility.AccessibleText.getBeforeIndex(int, int) (int part, int index)
          Returns the String before a given index.
 int getCaretPosition sample code for javax.accessibility.AccessibleText.getCaretPosition() definition code for javax.accessibility.AccessibleText.getCaretPosition() ()
          Returns the zero-based offset of the caret.
 AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet getCharacterAttribute sample code for javax.accessibility.AccessibleText.getCharacterAttribute(int) definition code for javax.accessibility.AccessibleText.getCharacterAttribute(int) (int i)
          Returns the AttributeSet for a given character at a given index
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle getCharacterBounds sample code for javax.accessibility.AccessibleText.getCharacterBounds(int) definition code for javax.accessibility.AccessibleText.getCharacterBounds(int) (int i)
          Determines the bounding box of the character at the given index into the string.
 int getCharCount sample code for javax.accessibility.AccessibleText.getCharCount() definition code for javax.accessibility.AccessibleText.getCharCount() ()
          Returns the number of characters (valid indicies)
 int getIndexAtPoint sample code for javax.accessibility.AccessibleText.getIndexAtPoint(java.awt.Point) definition code for javax.accessibility.AccessibleText.getIndexAtPoint(java.awt.Point) (Point sample code for java.awt.Point definition code for java.awt.Point  p)
          Given a point in local coordinates, return the zero-based index of the character under that Point.
 String sample code for java.lang.String definition code for java.lang.String getSelectedText sample code for javax.accessibility.AccessibleText.getSelectedText() definition code for javax.accessibility.AccessibleText.getSelectedText() ()
          Returns the portion of the text that is selected.
 int getSelectionEnd sample code for javax.accessibility.AccessibleText.getSelectionEnd() definition code for javax.accessibility.AccessibleText.getSelectionEnd() ()
          Returns the end offset within the selected text.
 int getSelectionStart sample code for javax.accessibility.AccessibleText.getSelectionStart() definition code for javax.accessibility.AccessibleText.getSelectionStart() ()
          Returns the start offset within the selected text.
 

Field Detail

CHARACTER sample code for javax.accessibility.AccessibleText.CHARACTER

static final int CHARACTER
Constant used to indicate that the part of the text that should be retrieved is a character.

See Also:
getAtIndex(int, int) sample code for javax.accessibility.AccessibleText.getAtIndex(int, int) definition code for javax.accessibility.AccessibleText.getAtIndex(int, int) , getAfterIndex(int, int) sample code for javax.accessibility.AccessibleText.getAfterIndex(int, int) definition code for javax.accessibility.AccessibleText.getAfterIndex(int, int) , getBeforeIndex(int, int) sample code for javax.accessibility.AccessibleText.getBeforeIndex(int, int) definition code for javax.accessibility.AccessibleText.getBeforeIndex(int, int) , Constant Field Values

WORD sample code for javax.accessibility.AccessibleText.WORD

static final int WORD
Constant used to indicate that the part of the text that should be retrieved is a word.

See Also:
getAtIndex(int, int) sample code for javax.accessibility.AccessibleText.getAtIndex(int, int) definition code for javax.accessibility.AccessibleText.getAtIndex(int, int) , getAfterIndex(int, int) sample code for javax.accessibility.AccessibleText.getAfterIndex(int, int) definition code for javax.accessibility.AccessibleText.getAfterIndex(int, int) , getBeforeIndex(int, int) sample code for javax.accessibility.AccessibleText.getBeforeIndex(int, int) definition code for javax.accessibility.AccessibleText.getBeforeIndex(int, int) , Constant Field Values

SENTENCE sample code for javax.accessibility.AccessibleText.SENTENCE

static final int SENTENCE
Constant used to indicate that the part of the text that should be retrieved is a sentence.

See Also:
getAtIndex(int, int) sample code for javax.accessibility.AccessibleText.getAtIndex(int, int) definition code for javax.accessibility.AccessibleText.getAtIndex(int, int) , getAfterIndex(int, int) sample code for javax.accessibility.AccessibleText.getAfterIndex(int, int) definition code for javax.accessibility.AccessibleText.getAfterIndex(int, int) , getBeforeIndex(int, int) sample code for javax.accessibility.AccessibleText.getBeforeIndex(int, int) definition code for javax.accessibility.AccessibleText.getBeforeIndex(int, int) , Constant Field Values
Method Detail

getIndexAtPoint sample code for javax.accessibility.AccessibleText.getIndexAtPoint(java.awt.Point) definition code for javax.accessibility.AccessibleText.getIndexAtPoint(java.awt.Point)

int getIndexAtPoint(Point sample code for java.awt.Point definition code for java.awt.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; if Point is invalid return -1.

getCharacterBounds sample code for javax.accessibility.AccessibleText.getCharacterBounds(int) definition code for javax.accessibility.AccessibleText.getCharacterBounds(int)

Rectangle sample code for java.awt.Rectangle definition code for java.awt.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 an empty rectangle is returned.

Parameters:
i - the index into the String
Returns:
the screen coordinates of the character's bounding box, if index is invalid return an empty rectangle.

getCharCount sample code for javax.accessibility.AccessibleText.getCharCount() definition code for javax.accessibility.AccessibleText.getCharCount()

int getCharCount()
Returns the number of characters (valid indicies)

Returns:
the number of characters

getCaretPosition sample code for javax.accessibility.AccessibleText.getCaretPosition() definition code for javax.accessibility.AccessibleText.getCaretPosition()

int getCaretPosition()
Returns the zero-based offset of the caret. Note: That 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.

getAtIndex sample code for javax.accessibility.AccessibleText.getAtIndex(int, int) definition code for javax.accessibility.AccessibleText.getAtIndex(int, int)

String sample code for java.lang.String definition code for java.lang.String  getAtIndex(int part,
                  int index)
Returns the String at a given index.

Parameters:
part - the CHARACTER, WORD, or SENTENCE to retrieve
index - an index within the text
Returns:
the letter, word, or sentence

getAfterIndex sample code for javax.accessibility.AccessibleText.getAfterIndex(int, int) definition code for javax.accessibility.AccessibleText.getAfterIndex(int, int)

String sample code for java.lang.String definition code for java.lang.String  getAfterIndex(int part,
                     int index)
Returns the String after a given index.

Parameters:
part - the CHARACTER, WORD, or SENTENCE to retrieve
index - an index within the text
Returns:
the letter, word, or sentence

getBeforeIndex sample code for javax.accessibility.AccessibleText.getBeforeIndex(int, int) definition code for javax.accessibility.AccessibleText.getBeforeIndex(int, int)

String sample code for java.lang.String definition code for java.lang.String  getBeforeIndex(int part,
                      int index)
Returns the String before a given index.

Parameters:
part - the CHARACTER, WORD, or SENTENCE to retrieve
index - an index within the text
Returns:
the letter, word, or sentence

getCharacterAttribute sample code for javax.accessibility.AccessibleText.getCharacterAttribute(int) definition code for javax.accessibility.AccessibleText.getCharacterAttribute(int)

AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.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

getSelectionStart sample code for javax.accessibility.AccessibleText.getSelectionStart() definition code for javax.accessibility.AccessibleText.getSelectionStart()

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.

Returns:
the index into the text of the start of the selection

getSelectionEnd sample code for javax.accessibility.AccessibleText.getSelectionEnd() definition code for javax.accessibility.AccessibleText.getSelectionEnd()

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.

Returns:
the index into teh text of the end of the selection

getSelectedText sample code for javax.accessibility.AccessibleText.getSelectedText() definition code for javax.accessibility.AccessibleText.getSelectedText()

String sample code for java.lang.String definition code for java.lang.String  getSelectedText()
Returns the portion of the text that is selected.

Returns:
the String portion of the text that is selected