public interface AccessibleText
的accessibletext接口应该被所有的类,在显示当前文本信息实现。该接口提供了一个辅助技术的标准机制,通过它的内容,属性和空间位置访问该文本。应用程序可以确定一个对象是否支持accessibletext界面首先获得其accessiblecontext(见Accessible
)然后调用的方法accessiblecontext AccessibleContext.getAccessibleText()
。如果返回值不是为空,对象支持此接口。
Modifier and Type | Field and Description |
---|---|
static int |
CHARACTER
常量用来表示要检索的文本的一部分是一个字符。
|
static int |
SENTENCE
常量用来表示要检索的文本的一部分是一个句子。
|
static int |
WORD
常量用来表示要检索的文本的一部分是一个词。
|
Modifier and Type | Method and Description |
---|---|
String |
getAfterIndex(int part, int index)
返回给定索引后的字符串。
|
String |
getAtIndex(int part, int index)
返回给定索引处的字符串。
|
String |
getBeforeIndex(int part, int index)
返回给定索引之前的字符串。
|
int |
getCaretPosition()
返回零基础的符号偏移。
|
AttributeSet |
getCharacterAttribute(int i)
返回一个给定的字符在一个给定的指标attributeset
|
Rectangle |
getCharacterBounds(int i)
确定在给定索引处的字符的边框框到字符串中。
|
int |
getCharCount()
返回的字符数(有效的指标)
|
int |
getIndexAtPoint(Point p)
给定一个局部坐标中的一个点,返回在该点下的字符的零为基础的索引。
|
String |
getSelectedText()
返回所选择的文本的部分。
|
int |
getSelectionEnd()
返回所选文本中的结束偏移量。
|
int |
getSelectionStart()
返回所选文本中的开始偏移量。
|
static final int CHARACTER
static final int WORD
static final int SENTENCE
int getIndexAtPoint(Point p)
p
在局部坐标系的坐标点
Rectangle getCharacterBounds(int i)
i
的指标转化为字符串
int getCharCount()
int getCaretPosition()
String getAtIndex(int part, int index)
part
-字,词,或句子检索
index
在文本索引
String getAfterIndex(int part, int index)
part
-字,词,或句子检索
index
在文本索引
String getBeforeIndex(int part, int index)
part
-字,词,或句子检索
index
在文本索引
AttributeSet getCharacterAttribute(int i)
i
-零基础的指标转化为文本
int getSelectionStart()
int getSelectionEnd()
String getSelectedText()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.