-
- All Known Subinterfaces:
-
AccessibleEditableText,AccessibleHypertext
- 所有已知实现类:
-
AbstractButton.AccessibleAbstractButton,JButton.AccessibleJButton,JCheckBox.AccessibleJCheckBox,JCheckBoxMenuItem.AccessibleJCheckBoxMenuItem,JEditorPane.AccessibleJEditorPane,JEditorPane.AccessibleJEditorPaneHTML,JEditorPane.JEditorPaneAccessibleHypertextSupport,JLabel.AccessibleJLabel,JMenu.AccessibleJMenu,JMenuItem.AccessibleJMenuItem,JPasswordField.AccessibleJPasswordField,JRadioButton.AccessibleJRadioButton,JRadioButtonMenuItem.AccessibleJRadioButtonMenuItem,JSpinner.AccessibleJSpinner,JTextArea.AccessibleJTextArea,JTextComponent.AccessibleJTextComponent,JTextField.AccessibleJTextField,JToggleButton.AccessibleJToggleButton,ProgressMonitor.AccessibleProgressMonitor,TextArea.AccessibleAWTTextArea,TextComponent.AccessibleAWTTextComponent,TextField.AccessibleAWTTextField
public interface AccessibleTextAccessibleText接口应由在显示器上显示文本信息的所有类实现。 此接口为辅助技术提供标准机制,以通过其内容,属性和空间位置访问该文本。 应用程序可确定对象是否支持AccessibleText通过首先获得接口其AccessibleContext(见Accessible),然后调用AccessibleContext.getAccessibleText()的方法AccessibleContext。 如果返回值不是null,则对象支持此接口。
-
-
方法摘要
所有方法 实例方法 抽象方法 变量和类型 方法 描述 StringgetAfterIndex(int part, int index)返回给定索引后的String。StringgetAtIndex(int part, int index)返回给定索引处的String。StringgetBeforeIndex(int part, int index)返回给定索引之前的String。intgetCaretPosition()返回插入符号从零开始的偏移量。AttributeSetgetCharacterAttribute(int i)返回给定索引处给定字符的AttributeSet。RectanglegetCharacterBounds(int i)确定给定索引处字符的边界框。intgetCharCount()返回字符数(有效标记)。intgetIndexAtPoint(Point p)给定本地坐标中的一个点,返回该点下该字符的从零开始的索引。StringgetSelectedText()返回所选文本的部分。intgetSelectionEnd()返回所选文本中的结束偏移量。intgetSelectionStart()返回所选文本中的起始偏移量。
-
-
-
方法详细信息
-
getIndexAtPoint
int getIndexAtPoint(Point p)
给定本地坐标中的一个点,返回该点下该字符的从零开始的索引。 如果该点无效,则此方法返回-1。- 参数
-
p- 本地坐标中的点 - 结果
-
Point p下该字符的从零开始的索引; 如果point无效则返回-1。
-
getCharacterBounds
Rectangle getCharacterBounds(int i)
确定给定索引处字符的边界框。 边界以本地坐标返回。 如果索引无效,则返回空矩形。- 参数
-
i- 字符串的索引 - 结果
- 字符边界框的屏幕坐标,如果索引无效则返回一个空矩形。
-
getCharCount
int getCharCount()
返回字符数(有效标记)。- 结果
- 字符数
-
getCaretPosition
int getCaretPosition()
返回插入符号从零开始的偏移量。注意:插入符右侧的索引值与偏移量相同(插入符号在两个字符之间)。
- 结果
- 插入符号从零开始的偏移量
-
getAtIndex
String getAtIndex(int part, int index)
返回给定索引处的String。- 参数
-
part- 要检索的CHARACTER,WORD或SENTENCE -
index- 文本中的索引 - 结果
- 字母,单词或句子
-
getAfterIndex
String getAfterIndex(int part, int index)
返回给定索引后的String。- 参数
-
part- 要检索的CHARACTER,WORD或SENTENCE -
index- 文本中的索引 - 结果
- 字母,单词或句子
-
getBeforeIndex
String getBeforeIndex(int part, int index)
返回给定索引之前的String。- 参数
-
part- 要检索的CHARACTER,WORD或SENTENCE -
index- 文本中的索引 - 结果
- 字母,单词或句子
-
getCharacterAttribute
AttributeSet getCharacterAttribute(int i)
返回给定索引处给定字符的AttributeSet。- 参数
-
i- 文本中从零开始的索引 - 结果
-
该角色的
AttributeSet
-
getSelectionStart
int getSelectionStart()
返回所选文本中的起始偏移量。 如果没有选择,但有一个插入符号,则开始和结束偏移将是相同的。- 结果
- 将索引放入选择开始的文本中
-
getSelectionEnd
int getSelectionEnd()
返回所选文本中的结束偏移量。 如果没有选择,但有一个插入符号,则开始和结束偏移将是相同的。- 结果
- 将索引放入选择结尾的文本中
-
getSelectedText
String getSelectedText()
返回所选文本的部分。- 结果
-
the
Stringportion of the text that is selected
-
-