Method from javax.swing.text.html.AccessibleHTML$TextElementInfo$TextAccessibleContext Detail: |
public String getAccessibleDescription() {
return editor.getContentType();
}
Gets the accessibleDescription property of this object. If this
property isn't set, returns the content type of this
JEditorPane instead (e.g. "plain/text", "html/text"). |
public String getAccessibleName() {
if (model != null) {
return (String)model.getProperty(Document.TitleProperty);
} else {
return null;
}
}
Gets the accessibleName property of this object. The accessibleName
property of an object is a localized String that designates the purpose
of the object. For example, the accessibleName property of a label
or button might be the text of the label or button itself. In the
case of an object that doesn't display its name, the accessibleName
should still be set. For example, in the case of a text field used
to enter the name of a city, the accessibleName for the en_US locale
could be 'city.' |
public AccessibleRole getAccessibleRole() {
return AccessibleRole.TEXT;
}
Gets the role of this object. The role of the object is the generic
purpose or use of the class of this object. For example, the role
of a push button is AccessibleRole.PUSH_BUTTON. The roles in
AccessibleRole are provided so component developers can pick from
a set of predefined roles. This enables assistive technologies to
provide a consistent interface to various tweaked subclasses of
components (e.g., use AccessibleRole.PUSH_BUTTON for all components
that act like a push button) as well as distinguish between sublasses
that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
and AccessibleRole.RADIO_BUTTON for radio buttons).
Note that the AccessibleRole class is also extensible, so
custom component developers can define their own AccessibleRole's
if the set of predefined roles is inadequate. |
public AccessibleText getAccessibleText() {
return this;
}
|
public String getAfterIndex(int part,
int index) {
return getAtIndex(part, index, 1);
}
|
public String getAtIndex(int part,
int index) {
return getAtIndex(part, index, 0);
}
|
public String getBeforeIndex(int part,
int index) {
return getAtIndex(part, index, -1);
}
|
public int getCaretPosition() {
View v = getView();
if (v == null) {
return -1;
}
Container c = v.getContainer();
if (c == null) {
return -1;
}
if (c instanceof JTextComponent) {
return ((JTextComponent)c).getCaretPosition();
} else {
return -1;
}
}
Return 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). |
public int getCharCount() {
if (validateIfNecessary()) {
Element elem = elementInfo.getElement();
return elem.getEndOffset() - elem.getStartOffset();
}
return 0;
}
Return the number of characters (valid indicies) |
public AttributeSet getCharacterAttribute(int i) {
if (model instanceof StyledDocument) {
StyledDocument doc = (StyledDocument)model;
Element elem = doc.getCharacterElement(i);
if (elem != null) {
return elem.getAttributes();
}
}
return null;
}
Return the AttributeSet for a given character at a given index |
public Rectangle getCharacterBounds(int i) {
try {
return editor.getUI().modelToView(editor, i);
} catch (BadLocationException e) {
return null;
}
}
Determine 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. |
public int getIndexAtPoint(Point p) {
View v = getView();
if (v != null) {
return v.viewToModel(p.x, p.y, getBounds());
} else {
return -1;
}
}
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. |
public String getSelectedText() {
return editor.getSelectedText();
}
Returns the portion of the text that is selected. |
public int getSelectionEnd() {
return editor.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. |
public int getSelectionStart() {
return editor.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. |