Examples of InputMap


Examples of javax.swing.InputMap

   * Changes the input map of furniture library view to ensure accelerators work even with no menu.
   */
  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

Examples of javax.swing.InputMap

import com.cburch.draw.toolbar.ToolbarModel;

public class KeyboardToolSelection extends AbstractAction {
  public static void register(Toolbar toolbar) {
    ActionMap amap = toolbar.getActionMap();
    InputMap imap = toolbar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    int mask = toolbar.getToolkit().getMenuShortcutKeyMask();
    for (int i = 0; i < 10; i++) {
      KeyStroke keyStroke = KeyStroke.getKeyStroke((char) ('0' + i), mask);
      int j = (i == 0 ? 10 : i - 1);
      KeyboardToolSelection action = new KeyboardToolSelection(toolbar, j);
      String key = "ToolSelect" + i;
      amap.put(key, action);
      imap.put(keyStroke, key);
    }
  }
View Full Code Here

Examples of javax.swing.InputMap

    curText = null;
    isTextNew = false;
    field = new EditableLabelField();
   
    fieldListener = new FieldListener();
    InputMap fieldInput = field.getInputMap();
    fieldInput.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
        "commit");
    fieldInput.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
        "cancel");
    ActionMap fieldAction = field.getActionMap();
    fieldAction.put("commit", fieldListener);
    fieldAction.put("cancel", new CancelListener());
  }
View Full Code Here

Examples of javax.swing.InputMap

    expandPath(new TreePath(model.getRoot()));

    mInstance = this;
    /* remove the F2 key from the keyboard bindings of the JTree */
    InputMap inputMap = getInputMap();
    KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0);
    inputMap.put(keyStroke, "none");

    new OverlayListener(this);
    (new DragSource()).createDefaultDragGestureRecognizer(this,
        DnDConstants.ACTION_MOVE, this);

View Full Code Here

Examples of javax.swing.InputMap

    contentPane.setLayout(new BorderLayout());
    contentPane.add(createParametersPanel(), BorderLayout.CENTER);
    contentPane.add(createButtonsPanel(), BorderLayout.SOUTH);
    setContentPane(contentPane);
   
    final InputMap inputMap = contentPane.getInputMap();
    final ActionMap actionMap = contentPane.getActionMap();

    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "confirm"); // NON-NLS
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NON-NLS
    actionMap.put("confirm", new OkAction()); // NON-NLS
    actionMap.put("cancel", new CancelAction()); // NON-NLS

    setModal(true);
    pack();
View Full Code Here

Examples of javax.swing.InputMap

        if (action.getValue(Action.SMALL_ICON) != null) {
            setText(null);
        }

        String name = (String) action.getValue(action.NAME);
        InputMap inputMap = this.getInputMap(this.WHEN_IN_FOCUSED_WINDOW);
        KeyStroke keyStroke = (KeyStroke) action.getValue(action.ACCELERATOR_KEY);
        inputMap.put(keyStroke, name);

        init(icon);
    }
View Full Code Here

Examples of javax.swing.InputMap

      panel1.add( buttonPanel, BorderLayout.SOUTH ) ;
      panel1.add( statusPanel, BorderLayout.CENTER ) ;
    }
    // Key bindings:
    ActionMap am = statusPanel.getActionMap() ;
    InputMap im = statusPanel.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW ) ;
    im.put( parent.prefs().getKey( "Close dialog" ), "close" ) ;
    am.put( "close", new AbstractAction()
    {
      public void actionPerformed( ActionEvent e )
      {
        dispose() ;
View Full Code Here

Examples of javax.swing.InputMap

  }


    void setupPanel(JabRefFrame frame, BasePanel bPanel, boolean addKeyField, String title) {
     
      InputMap im = panel.getInputMap(JComponent.WHEN_FOCUSED);
    ActionMap am = panel.getActionMap();

    im.put(Globals.prefs.getKey("Entry editor, previous entry"), "prev");
    am.put("prev", parent.prevEntryAction);
    im.put(Globals.prefs.getKey("Entry editor, next entry"), "next");
    am.put("next", parent.nextEntryAction);

    im.put(Globals.prefs.getKey("Entry editor, store field"), "store");
    am.put("store", parent.storeFieldAction);
    im.put(Globals.prefs.getKey("Entry editor, next panel"), "right");
    im.put(Globals.prefs.getKey("Entry editor, next panel 2"), "right");
    am.put("left", parent.switchLeftAction);
    im.put(Globals.prefs.getKey("Entry editor, previous panel"), "left");
    im.put(Globals.prefs.getKey("Entry editor, previous panel 2"), "left");
    am.put("right", parent.switchRightAction);
    im.put(Globals.prefs.getKey("Help"), "help");
    am.put("help", parent.helpAction);
    im.put(Globals.prefs.getKey("Save database"), "save");
    am.put("save", parent.saveDatabaseAction);
    im.put(Globals.prefs.getKey("Next tab"), "nexttab");
    am.put("nexttab", parent.frame.nextTab);
    im.put(Globals.prefs.getKey("Previous tab"), "prevtab");
    am.put("prevtab", parent.frame.prevTab);
     
         
        panel.setName(title);
        //String rowSpec = "left:pref, 4dlu, fill:pref:grow, 4dlu, fill:pref";
View Full Code Here

Examples of javax.swing.InputMap

            acl.setNextFocusListener(fieldListener);
        }
        else
        component.addFocusListener(fieldListener);

    InputMap im = component.getInputMap(JComponent.WHEN_FOCUSED);
    ActionMap am = component.getActionMap();

    im.put(Globals.prefs.getKey("Entry editor, previous entry"), "prev");
    am.put("prev", parent.prevEntryAction);
    im.put(Globals.prefs.getKey("Entry editor, next entry"), "next");
    am.put("next", parent.nextEntryAction);

    im.put(Globals.prefs.getKey("Entry editor, store field"), "store");
    am.put("store", parent.storeFieldAction);
    im.put(Globals.prefs.getKey("Entry editor, next panel"), "right");
    im.put(Globals.prefs.getKey("Entry editor, next panel 2"), "right");
    am.put("left", parent.switchLeftAction);
    im.put(Globals.prefs.getKey("Entry editor, previous panel"), "left");
    im.put(Globals.prefs.getKey("Entry editor, previous panel 2"), "left");
    am.put("right", parent.switchRightAction);
    im.put(Globals.prefs.getKey("Help"), "help");
    am.put("help", parent.helpAction);
    im.put(Globals.prefs.getKey("Save database"), "save");
    am.put("save", parent.saveDatabaseAction);
    im.put(Globals.prefs.getKey("Next tab"), "nexttab");
    am.put("nexttab", parent.frame.nextTab);
    im.put(Globals.prefs.getKey("Previous tab"), "prevtab");
    am.put("prevtab", parent.frame.prevTab);

    try {
      HashSet<AWTKeyStroke> keys = new HashSet<AWTKeyStroke>(component
        .getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
View Full Code Here

Examples of javax.swing.InputMap

      table.setRowSelectionInterval(0,0);

  gbl.setConstraints(table.getPane(), con);
  pan.add(table.getPane());

  InputMap im = tlb.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
  ActionMap am = tlb.getActionMap();
  im.put(prefs.getKey("String dialog, add string"), "add");
  am.put("add", newStringAction);
  im.put(prefs.getKey("String dialog, remove string"), "remove");
  am.put("remove", removeStringAction);
  //im.put(prefs.getKey("String dialog, move string up"), "up");
  //am.put("up", stringUpAction);
  //im.put(prefs.getKey("String dialog, move string down"), "down");
  //am.put("down", stringDownAction);
  im.put(prefs.getKey("Close dialog"), "close");
  am.put("close", closeAction);
  im.put(prefs.getKey("Help"), "help");
  am.put("help", helpAction);
  im.put(prefs.getKey("Undo"), "undo");
  am.put("undo", undoAction);
  im.put(prefs.getKey("Redo"), "redo");
  am.put("redo", redoAction);

  //tlb.add(closeAction);
  //tlb.addSeparator();
  tlb.add(newStringAction);
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.