本文整理汇总了Java中javax.accessibility.AccessibleEditableText类的典型用法代码示例。如果您正苦于以下问题:Java AccessibleEditableText类的具体用法?Java AccessibleEditableText怎么用?Java AccessibleEditableText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessibleEditableText类属于javax.accessibility包,在下文中一共展示了AccessibleEditableText类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSelectedText
import javax.accessibility.AccessibleEditableText; //导入依赖的package包/类
static void setSelectedText(final Accessible a, final Component c, final String newText) {
if (a == null) return;
CAccessibility.invokeLater(new Runnable() {
public void run() {
final AccessibleContext ac = a.getAccessibleContext();
if (ac == null) return;
final AccessibleEditableText aet = ac.getAccessibleEditableText();
if (aet == null) return;
final int selectionStart = aet.getSelectionStart();
final int selectionEnd = aet.getSelectionEnd();
aet.replaceText(selectionStart, selectionEnd, newText);
}
}, c);
}
示例2: setSelectedTextRange
import javax.accessibility.AccessibleEditableText; //导入依赖的package包/类
static void setSelectedTextRange(final Accessible a, final Component c, final int startIndex, final int endIndex) {
if (a == null) return;
CAccessibility.invokeLater(new Runnable() {
public void run() {
final AccessibleContext ac = a.getAccessibleContext();
if (ac == null) return;
final AccessibleEditableText aet = ac.getAccessibleEditableText();
if (aet == null) return;
final boolean validRange = (startIndex >= 0) && (endIndex >= startIndex) && (endIndex <= aet.getCharCount());
if (!validRange) return;
aet.selectText(startIndex, endIndex);
}
}, c);
}
示例3: getAccessibleEditableText
import javax.accessibility.AccessibleEditableText; //导入依赖的package包/类
static AccessibleEditableText getAccessibleEditableText(final Accessible a, final Component c) {
if (a == null) return null;
return CAccessibility.invokeAndWait(new Callable<AccessibleEditableText>() {
public AccessibleEditableText call() throws Exception {
final AccessibleContext ac = a.getAccessibleContext();
if (ac == null) return null;
return ac.getAccessibleEditableText();
}
}, c);
}
示例4: getTextRange
import javax.accessibility.AccessibleEditableText; //导入依赖的package包/类
static String getTextRange(final AccessibleEditableText aet, final int start, final int stop, final Component c) {
if (aet == null) return null;
return CAccessibility.invokeAndWait(new Callable<String>() {
public String call() throws Exception {
return aet.getTextRange(start, stop);
}
}, c);
}
示例5: getStringForRange
import javax.accessibility.AccessibleEditableText; //导入依赖的package包/类
static String getStringForRange(final Accessible a, final Component c, final int location, final int length) {
if (a == null) return null;
return CAccessibility.invokeAndWait(new Callable<String>() {
public String call() throws Exception {
final AccessibleContext ac = a.getAccessibleContext();
if (ac == null) return null;
final AccessibleEditableText aet = ac.getAccessibleEditableText();
if (aet == null) return null;
return aet.getTextRange(location, location + length);
}
}, c);
}