Package javax.swing

Examples of javax.swing.ActionMap.allKeys()


  private void installAccelerators(JFrame furnitureFrame,
                                   final EditorController furnitureLibraryController) {
    JComponent furnitureLibraryView = (JComponent)furnitureLibraryController.getView();
    InputMap inputMap = furnitureLibraryView.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    ActionMap actionMap = furnitureLibraryView.getActionMap();
    for (Object key : actionMap.allKeys()) {
      if (key instanceof EditorView.ActionType) {
        inputMap.put((KeyStroke)actionMap.get(key).getValue(Action.ACCELERATOR_KEY), key);
      }
    }
  }
View Full Code Here


 
  public void test(TestHarness harness) {
          ActionMap map = new ActionMap();
          if (map.keys() != null)
            harness.fail("New ActionMap should return null for keys()");
          if (map.allKeys() != null)
            harness.fail ("New ActionMap should return null for allKeys()");
  }

}
View Full Code Here

    }

    public void testCreateActionMap() throws Exception {
        ui.installUI(fc);
        ActionMap map = ui.createActionMap();
        List<Object> allKeys = Arrays.asList(map.allKeys());
        assertEquals(3, allKeys.size());
        assertTrue(allKeys.contains("approveSelection"));
        assertEquals(ui.getApproveSelectionAction(), map.get("approveSelection"));
        assertTrue(allKeys.contains("cancelSelection"));
        assertEquals(ui.getCancelSelectionAction(), map.get("cancelSelection"));
View Full Code Here

        return false;
    }

    public Object[] getCommands() {
        ActionMap map = component.getActionMap();
        return map.allKeys();
    }

    public boolean hasCommand(Object command) {
        Object[] commands = getCommands();
        for (int i = 0; i < commands.length; i++) {
View Full Code Here

    }

    public void testCreateActionMap() throws Exception {
        ui.installUI(fc);
        ActionMap map = ui.createActionMap();
        List<Object> allKeys = Arrays.asList(map.allKeys());
        assertEquals(3, allKeys.size());
        assertTrue(allKeys.contains("approveSelection"));
        assertEquals(ui.getApproveSelectionAction(), map.get("approveSelection"));
        assertTrue(allKeys.contains("cancelSelection"));
        assertEquals(ui.getCancelSelectionAction(), map.get("cancelSelection"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.