Package javax.swing.text

Examples of javax.swing.text.Keymap


        );

        // Have default button get the keypress event.
        // This is broken with jdk1.3rc1
        KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
        Keymap km = displayText.getKeymap();
        km.removeKeyStrokeBinding(enter);
    }
View Full Code Here


        );

        // Have default button get the keypress event.
        // This is broken with jdk1.3rc1
        KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
        Keymap km = displayText.getKeymap();
        km.removeKeyStrokeBinding(enter);
    }
View Full Code Here

      }
      public void mouseEntered(MouseEvent e) {
      }
    });

    Keymap keymap = notationTextPane.getKeymap();
    keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_LEFT, 0), new AbstractAction() {
      public void actionPerformed(java.awt.event.ActionEvent e) {
        Notation.this.history.prev();
      }
    });
    keymap
    .addActionForKeyStroke(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_RIGHT, 0), new AbstractAction() {
      public void actionPerformed(java.awt.event.ActionEvent e) {
        Notation.this.history.next();
      }
    });
View Full Code Here

        textfield.setText("");
        parseInput(message);
      }
    });

    Keymap keymap = textfield.getKeymap();
    keymap
    .addActionForKeyStroke(
        KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP, 0),
        new AbstractAction() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            if (inputHistoryIndex > 0)
              inputHistoryIndex--;
            if (inputHistory.size() > 0)
              textfield.setText(
                  (String) inputHistory.get(inputHistoryIndex));
          }
        });
    keymap
    .addActionForKeyStroke(
        KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN, 0),
        new AbstractAction() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            if (inputHistoryIndex < inputHistory.size())
              inputHistoryIndex++;
            if (inputHistoryIndex == inputHistory.size())
              textfield.setText("");
            else
              textfield.setText(
                  (String) inputHistory.get(inputHistoryIndex));
          }
        });
    keymap
    .addActionForKeyStroke(
        KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0),
        new AbstractAction() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            inputHistoryIndex = inputHistory.size();
View Full Code Here

        return new BasicHighlighter();
    }

    protected Keymap createKeymap() {
        String name = getKeymapName();
        Keymap keymap = JTextComponent.getKeymap(name);
        if (keymap == null) {
            keymap = JTextComponent.addKeymap(name, JTextComponent
                    .getKeymap(JTextComponent.DEFAULT_KEYMAP));
        }
        Object bindings = UIManager.get(addPrefix(".keyBindings"));
View Full Code Here

     *
     */
    protected void installKeyboardActions() {
        installUIActionMap();
        installUIInputMap();
        Keymap keymap = createKeymap();
        component.setKeymap(keymap);
    }
View Full Code Here

    }

    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

    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

    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

    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

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.