Home » openjdk-7 » javax » swing » text » [javadoc | source]
javax.swing.text
public class: JTextComponent.AccessibleJTextComponent [javadoc | source]
java.lang.Object
   AccessibleJComponent
      javax.swing.text.JTextComponent$AccessibleJTextComponent

All Implemented Interfaces:
    AccessibleEditableText, AccessibleExtendedText, AccessibleText, AccessibleAction, DocumentListener, CaretListener

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

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .
Field Summary
 int caretPos     
 Point oldLocationOnScreen     
Constructor:
 public AccessibleJTextComponent() 
Method from javax.swing.text.JTextComponent$AccessibleJTextComponent Summary:
caretUpdate,   changedUpdate,   cut,   delete,   doAccessibleAction,   getAccessibleAction,   getAccessibleActionCount,   getAccessibleActionDescription,   getAccessibleEditableText,   getAccessibleRole,   getAccessibleStateSet,   getAccessibleText,   getAfterIndex,   getAtIndex,   getBeforeIndex,   getCaretPosition,   getCharCount,   getCharacterAttribute,   getCharacterBounds,   getIndexAtPoint,   getRootEditorRect,   getSelectedText,   getSelectionEnd,   getSelectionStart,   getTextBounds,   getTextRange,   getTextSequenceAfter,   getTextSequenceAt,   getTextSequenceBefore,   insertTextAtIndex,   insertUpdate,   paste,   removeUpdate,   replaceText,   selectText,   setAttributes,   setTextContents
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.text.JTextComponent$AccessibleJTextComponent Detail:
 public  void caretUpdate(CaretEvent e) 
    Handles caret updates (fire appropriate property change event, which are AccessibleContext.ACCESSIBLE_CARET_PROPERTY and AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY). This keeps track of the dot position internally. When the caret moves, the internal position is updated after firing the event.
 public  void changedUpdate(DocumentEvent e) 
    Handles document remove (fire appropriate property change event, which is AccessibleContext.ACCESSIBLE_TEXT_PROPERTY). This tracks the changed offset via the event.
 public  void cut(int startIndex,
    int endIndex) 
    Cuts the text between two indices into the system clipboard.
 public  void delete(int startIndex,
    int endIndex) 
    Deletes the text between two indices
 public boolean doAccessibleAction(int i) 
    Performs the specified Action on the object
 public AccessibleAction getAccessibleAction() 
 public int getAccessibleActionCount() 
    Returns the number of accessible actions available in this object If there are more than one, the first one is considered the "default" action of the object.
 public String getAccessibleActionDescription(int i) 
    Returns a description of the specified action of the object.
 public AccessibleEditableText getAccessibleEditableText() 
    Returns the AccessibleEditableText interface for this text component.
 public AccessibleRole getAccessibleRole() 
    Gets the role of this object.
 public AccessibleStateSet getAccessibleStateSet() 
    Gets the state set of the JTextComponent. The AccessibleStateSet of an object is composed of a set of unique AccessibleState's. A change in the AccessibleStateSet of an object will cause a PropertyChangeEvent to be fired for the AccessibleContext.ACCESSIBLE_STATE_PROPERTY property.
 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.
 public String getAfterIndex(int part,
    int index) 
    Returns the String after a given index. Whitespace between words is treated as a word.
 public String getAtIndex(int part,
    int index) 
    Returns the String at a given index. Whitespace between words is treated as a word.
 public String getBeforeIndex(int part,
    int index) 
    Returns the String before a given index. Whitespace between words is treated a word.
 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).
 public int getCharCount() 
    Returns the number of characters (valid indices)
 public AttributeSet getCharacterAttribute(int i) 
    Returns the AttributeSet for a given character (at a given index).
 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. The screen coordinates returned are "unscrolled coordinates" if the JTextComponent is contained in a JScrollPane in which case the resulting rectangle should be composed with the parent coordinates. A good algorithm to use is: Accessible a: AccessibleText at = a.getAccessibleText(); AccessibleComponent ac = a.getAccessibleComponent(); Rectangle r = at.getCharacterBounds(); Point p = ac.getLocation(); r.x += p.x; r.y += p.y; Note: the JTextComponent must have a valid size (e.g. have been added to a parent container whose ancestor container is a valid top-level window) for this method to be able to return a meaningful (non-null) value.
 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.
 Rectangle getRootEditorRect() 
    Gets the editor's drawing rectangle. Stolen from the unfortunately named BasicTextUI.getVisibleEditorRect()
 public String getSelectedText() 
    Returns the portion of the text that is selected.
 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.
 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.
 public Rectangle getTextBounds(int startIndex,
    int endIndex) 
    Returns the Rectangle enclosing the text between two indicies.
 public String getTextRange(int startIndex,
    int endIndex) 
    Returns the text string between two indices.
 public AccessibleTextSequence getTextSequenceAfter(int part,
    int index) 
    Returns the AccessibleTextSequence after a given index.
 public AccessibleTextSequence getTextSequenceAt(int part,
    int index) 
    Returns the AccessibleTextSequence at a given index.
 public AccessibleTextSequence getTextSequenceBefore(int part,
    int index) 
    Returns the AccessibleTextSequence before a given index.
 public  void insertTextAtIndex(int index,
    String s) 
    Inserts the specified string at the given index
 public  void insertUpdate(DocumentEvent e) 
    Handles document insert (fire appropriate property change event which is AccessibleContext.ACCESSIBLE_TEXT_PROPERTY). This tracks the changed offset via the event.
 public  void paste(int startIndex) 
    Pastes the text from the system clipboard into the text starting at the specified index.
 public  void removeUpdate(DocumentEvent e) 
    Handles document remove (fire appropriate property change event, which is AccessibleContext.ACCESSIBLE_TEXT_PROPERTY). This tracks the changed offset via the event.
 public  void replaceText(int startIndex,
    int endIndex,
    String s) 
    Replaces the text between two indices with the specified string.
 public  void selectText(int startIndex,
    int endIndex) 
    Selects the text between two indices.
 public  void setAttributes(int startIndex,
    int endIndex,
    AttributeSet as) 
    Sets attributes for the text between two indices.
 public  void setTextContents(String s) 
    Sets the text contents to the specified string.