Package javax.swing.text

Examples of javax.swing.text.Keymap


    }

    public void testCreateKeymap() {
        JTextComponent.removeKeymap("BasicTextAreaUI");
        TextUI ui = jta.getUI();
        Keymap keymap = ((BasicTextUI) ui).createKeymap();
        assertEquals(getKeymapName(jta), keymap.getName());
        assertTrue(keymap.getDefaultAction() instanceof DefaultEditorKit.DefaultKeyTypedAction);
        assertEquals(0, keymap.getBoundActions().length);
        assertEquals(0, keymap.getBoundKeyStrokes().length);
        assertEquals(JTextComponent.DEFAULT_KEYMAP, keymap.getResolveParent().getName());
    }
View Full Code Here


        myUndoManager.addEdit(e.getEdit());
      }
    };
    myTextComponent.getDocument().addUndoableEditListener(myUndoableEditListener);
    myOldKeymap = myTextComponent.getKeymap();
    Keymap keymap = JTextComponent.addKeymap(null, myOldKeymap);
    com.intellij.openapi.keymap.Keymap activeKeymap = KeymapManager.getInstance().getActiveKeymap();
    Shortcut[] undoShortcuts = activeKeymap.getShortcuts("$Undo");
    Shortcut[] redoShortcuts = activeKeymap.getShortcuts("$Redo");

    Action undoAction = new AbstractAction ("Undo") {
      public void actionPerformed(ActionEvent e) {
        if (myUndoManager.canUndo())
          myUndoManager.undo();
      }
    };

    Action redoAction = new AbstractAction ("Redo") {
      public void actionPerformed(ActionEvent e) {
        if (myUndoManager.canRedo())
          myUndoManager.redo();
      }
    };

    for (Shortcut undoShortcut : undoShortcuts) {
      if (undoShortcut instanceof KeyboardShortcut) {
        keymap.addActionForKeyStroke(((KeyboardShortcut)undoShortcut).getFirstKeyStroke(), undoAction);
      }
    }

    for (Shortcut redoShortcut : redoShortcuts) {
      if (redoShortcut instanceof KeyboardShortcut) {
        keymap.addActionForKeyStroke(((KeyboardShortcut)redoShortcut).getFirstKeyStroke(), redoAction);
      }
    }

    myTextComponent.setKeymap(keymap);
  }
View Full Code Here

    SessionPane.add(passwdField, new GridBagConstraints(1, 6, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
      new Insets(0, 0, 0, 0), 0, 0));

  /* Remove the RETURN key from the shared map of JTextFields */
    Keymap map = hostField.getKeymap();
    KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    map.removeKeyStrokeBinding(key);

  /* Make the OK button the default button */
    this.getRootPane().setDefaultButton(okButton);

  } //private jbInit()
View Full Code Here

            public void removeUpdate(DocumentEvent e) {
                setStringViaReflection(humanField,field.getText());
            }
        });
    Keymap keymap=net.sf.egphilippovoss.util.swing.CTextArea.addKeymap("keymap"+tabOrder.size(), field.getKeymap());
    keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0),
        new AbstractAction(){
          private static final long serialVersionUID = -1354646991611133126L;

          @Override
          public void actionPerformed(ActionEvent e) {
            handleTab(nc, false, field, frame.getProductMetaData());
          }});
    keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,InputEvent.SHIFT_MASK),
        new AbstractAction(){
          private static final long serialVersionUID = -110179313042841593L;

          @Override
          public void actionPerformed(ActionEvent e) {
View Full Code Here

TOP

Related Classes of javax.swing.text.Keymap

Copyright © 2018 www.massapicom. 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.