-
- 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,则该对象支持该接口。
-
-
方法摘要
所有方法 接口方法 抽象方法 Modifier and Type 方法 描述 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; 如果点无效返回-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
-
-