当前位置: 首页>>代码示例>>Java>>正文


Java AccessibleAction类代码示例

本文整理汇总了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);
		}
	});
}
 
开发者ID:nomis,项目名称:cursus-ui,代码行数:17,代码来源:AbstractUITest.java

示例2: getAccessibleAction

import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction()
{
  AccessibleContext ac = getAccessibleColumnHeaderRenderer();
  if (ac instanceof AccessibleAction)
    return (AccessibleAction) ac;
  else
    return null;
}
 
开发者ID:vilie,项目名称:javify,代码行数:9,代码来源:JTableHeader.java

示例3: getAccessibleAction

import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction()
{
  AccessibleContext ac = getAccessibleColumnHeaderRenderer();
  if (ac instanceof AccessibleAction)
    return (AccessibleAction) ac;
  else 
    return null;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:9,代码来源:JTableHeader.java

示例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.
  }

}
 
开发者ID:gigony,项目名称:GUITester-core,代码行数:34,代码来源:ActionableEvent_JFC.java

示例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;

}
 
开发者ID:gigony,项目名称:GUITester-core,代码行数:37,代码来源:ActionableEvent_JFC.java

示例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;
  }
 
开发者ID:gigony,项目名称:GUITester-core,代码行数:41,代码来源:FileChooserDialogEvent_JFC.java

示例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(); }
        });
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:58,代码来源:Bug8161483.java

示例8: getAccessibleAction

import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction() {
	return this;
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:4,代码来源:MenuItem.java

示例9: getAccessibleAction

import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction()
{
  return this;
}
 
开发者ID:vilie,项目名称:javify,代码行数:5,代码来源:Button.java

示例10: getAccessibleAction

import javax.accessibility.AccessibleAction; //导入依赖的package包/类
@Override
public AccessibleAction getAccessibleAction() {
    return this;
}
 
开发者ID:mike10004,项目名称:appengine-imaging,代码行数:5,代码来源:CheckboxMenuItem.java

示例11: testGetAccessibleAction

import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public final void testGetAccessibleAction() {
    AccessibleAction aa = ac.getAccessibleAction();
    assertNotNull(aa);
    assertTrue(aa instanceof AccessibleAWTButton);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:6,代码来源:AccessibleAWTButtonTest.java

示例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));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:7,代码来源:AccessibleAWTButtonTest.java

示例13: testGetAccessibleAction

import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public final void testGetAccessibleAction() {
    AccessibleAction aa = ac.getAccessibleAction();
    assertNotNull(aa);
    assertTrue(aa instanceof AccessibleAWTCheckbox);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:6,代码来源:AccessibleAWTCheckboxTest.java

示例14: getAccessibleAction

import javax.accessibility.AccessibleAction; //导入依赖的package包/类
@Override
public AccessibleAction getAccessibleAction() throws NotImplementedException {
    throw new NotImplementedException();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:5,代码来源:JTree.java

示例15: getAccessibleAction

import javax.accessibility.AccessibleAction; //导入依赖的package包/类
public AccessibleAction getAccessibleAction() {
    return this;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:JTextComponent.java


注:本文中的javax.accessibility.AccessibleAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。