本文整理汇总了Java中javax.accessibility.AccessibleAction类的典型用法代码示例。如果您正苦于以下问题:Java AccessibleAction类的具体用法?Java AccessibleAction怎么用?Java AccessibleAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessibleAction类属于javax.accessibility包,在下文中一共展示了AccessibleAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public boolean accessibleAction(final Accessible accessible, final int index) throws Exception {
return callFromEventThread(new Callable<Boolean>() {
@Override
public Boolean call() {
log.debug("Accessible " + accessibleToString(accessible)); //$NON-NLS-1$
AccessibleAction action = accessible.getAccessibleContext().getAccessibleAction();
for (int i = 0; i < action.getAccessibleActionCount(); i++) {
log.debug(" Action " + i + ": \"" + action.getAccessibleActionDescription(i) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
log.info("Performing " + index + ":" //$NON-NLS-1$ //$NON-NLS-2$
+ " \"" + action.getAccessibleActionDescription(index) + "\"" //$NON-NLS-1$ //$NON-NLS-2$
+ " on " + accessibleToString(accessible)); //$NON-NLS-1$
return action.doAccessibleAction(index);
}
});
}
示例2: getAccessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction()
{
AccessibleContext ac = getAccessibleColumnHeaderRenderer();
if (ac instanceof AccessibleAction)
return (AccessibleAction) ac;
else
return null;
}
示例3: getAccessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction()
{
AccessibleContext ac = getAccessibleColumnHeaderRenderer();
if (ac instanceof AccessibleAction)
return (AccessibleAction) ac;
else
return null;
}
示例4: performImpl
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
@Override
public void performImpl(Object... args) {
((Window) getWindowModel().getRef()).requestFocus();
final AccessibleContext aContext = JFCUtil.getAccessibleContext(componentModel);
AccessibleAction aAction = aContext.getAccessibleAction();
Accessible accessibleobj = (Accessible) getAccessibleComponent();
if (accessibleobj instanceof Component) {
Component comp = (Component) accessibleobj;
int w = comp.getWidth();
int h = comp.getHeight();
int x = w / 2;
int y = h / 2;
MouseEvent mouseMoveEvent = new MouseEvent(comp, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 16, x, y, 1,
false, MouseEvent.BUTTON1);
comp.dispatchEvent(mouseMoveEvent);
MouseEvent mousePressEvent = new MouseEvent(comp, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 16, x, y,
1, false, MouseEvent.BUTTON1);
comp.dispatchEvent(mousePressEvent);
MouseEvent mouseReleaseEvent = new MouseEvent(comp, MouseEvent.MOUSE_RELEASED, System.currentTimeMillis(), 16, x,
y, 1, false, MouseEvent.BUTTON1);
comp.dispatchEvent(mouseReleaseEvent);
MouseEvent mouseClickEvent = new MouseEvent(comp, MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(), 16, x, y,
1, false, MouseEvent.BUTTON1);
comp.dispatchEvent(mouseClickEvent);
} else {
aAction.doAccessibleAction(0); // only first event will be executed.
}
}
示例5: isSupportedBy
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
@Override
public boolean isSupportedBy(ComponentModel model) {
// skip fileChooser dialog.
WindowModel winModel = GUIModelExtractor.getWindowModel(model);
if (winModel != null && winModel.get("windowlisteners") != null
&& winModel.get("windowlisteners").indexOf("javax.swing.JFileChooser") >= 0) {
return false;
}
AccessibleAction aAction = JFCUtil.getAccessibleContext(model).getAccessibleAction();
Accessible accessibleObj = (Accessible) model.getRef();
if (aAction == null)
return false;
if (aAction.getAccessibleActionCount() == 0)
return false;
if (accessibleObj instanceof JMenuItem) {
return false; // should be handled by SelectionMenuEvent
}
if (accessibleObj instanceof JTextComponent) {
return false; // should be handled by EditableTextEvent
}
if (accessibleObj instanceof BasicArrowButton) {
return false; // should be handled by ValueEvnet
}
if (accessibleObj instanceof JComboBox) {
return false; // should be handled by SelectionEvent
}
if (accessibleObj instanceof JSpinner) {
return false; // should be handled by SelectionEvent
}
return true;
}
示例6: findTargetBtnComponent
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
private ComponentModel findTargetBtnComponent(GUIModel root) {
for (Enumeration<GUIModel> enumuration = (Enumeration<GUIModel>) root.depthFirstEnumeration(); enumuration
.hasMoreElements();) {
GUIModel node = enumuration.nextElement();
Object userObj = node.getUserObject();
if (userObj instanceof ComponentModel) {
ComponentModel model = (ComponentModel) userObj;
AccessibleAction aAction = JFCUtil.getAccessibleContext(model).getAccessibleAction();
Accessible accessibleObj = (Accessible) model.getRef();
if (aAction == null)
continue;
if (aAction.getAccessibleActionCount() == 0)
continue;
if (accessibleObj instanceof JMenuItem) {
continue; // should be handled by SelectionMenuEvent
}
if (accessibleObj instanceof JTextComponent) {
continue; // should be handled by EditableTextEvent
}
if (accessibleObj instanceof BasicArrowButton) {
continue; // should be handled by ValueEvnet
}
if (accessibleObj instanceof JComboBox) {
continue; // should be handled by SelectionEvent
}
if (accessibleObj instanceof JSpinner) {
continue; // should be handled by SelectionEvent
}
String title = model.get("title");
if (title.equalsIgnoreCase(targetBtnName)) {
return model;
}
}
}
return null;
}
示例7: main
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
try {
SwingUtilities.invokeAndWait(() -> {
DefaultListModel<String> listModel = new DefaultListModel<>();
listModel.addElement("one");
listModel.addElement("two");
listModel.addElement("three");
JList<String> list = new JList<>(listModel);
frame = new JFrame();
frame.add(list);
frame.pack();
try {
AccessibleContext acList = list.getAccessibleContext();
Accessible accChild = acList.getAccessibleChild(1);
AccessibleContext acChild = accChild.getAccessibleContext();
AccessibleAction aa = acChild.getAccessibleAction();
int c = aa.getAccessibleActionCount();
if (c != 1) {
throw new RuntimeException("getAccessibleActionCount is not 1");
}
String s = aa.getAccessibleActionDescription(0);
if (!s.equals("click")) {
throw new RuntimeException("getAccessibleActionDescription is not click");
}
boolean b = aa.doAccessibleAction(0);
if (!b) {
throw new RuntimeException("doAccessibleAction did not return true");
}
AccessibleSelection as = acList.getAccessibleSelection();
int asc = as.getAccessibleSelectionCount();
if (asc != 1) {
throw new RuntimeException("getAccessibleSelectionCount is not 1");
}
boolean isSelected = as.isAccessibleChildSelected(0);
if (isSelected) {
throw new RuntimeException("isAccessibleChildSelected(0) did not return false");
}
isSelected = as.isAccessibleChildSelected(1);
if (!isSelected) {
throw new RuntimeException("isAccessibleChildSelected(1) did not return true");
}
} catch (Exception e) {
exception = e;
}
});
if (exception != null) {
System.out.println("Test failed: " + exception.getMessage());
throw exception;
} else {
System.out.println("Test passed.");
}
} finally {
SwingUtilities.invokeAndWait(() -> {
if (frame != null) { frame.dispose(); }
});
}
}
示例8: getAccessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction() {
return this;
}
示例9: getAccessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction()
{
return this;
}
示例10: getAccessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
@Override
public AccessibleAction getAccessibleAction() {
return this;
}
示例11: testGetAccessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public final void testGetAccessibleAction() {
AccessibleAction aa = ac.getAccessibleAction();
assertNotNull(aa);
assertTrue(aa instanceof AccessibleAWTButton);
}
示例12: testGetAccessibleActionDescription
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public final void testGetAccessibleActionDescription() {
AccessibleAction aa = ac.getAccessibleAction();
assertNull(aa.getAccessibleActionDescription(-1));
assertEquals("click", aa.getAccessibleActionDescription(0));
assertNull(aa.getAccessibleActionDescription(1));
}
示例13: testGetAccessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public final void testGetAccessibleAction() {
AccessibleAction aa = ac.getAccessibleAction();
assertNotNull(aa);
assertTrue(aa instanceof AccessibleAWTCheckbox);
}
示例14: getAccessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
@Override
public AccessibleAction getAccessibleAction() throws NotImplementedException {
throw new NotImplementedException();
}
示例15: getAccessibleAction
import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction() {
return this;
}