Java Utililty Methods JTextComponent Key

List of utility methods to do JTextComponent Key

Description

The list of methods to do JTextComponent Key are organized into topic(s).

Method

voidaddKeyBindings(final JTextComponent comp)
_more_
comp.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
        if (!e.isControlDown()) {
            return;
        int pos = comp.getCaretPosition();
        if (e.getKeyCode() == e.VK_B) {
            if (comp.getCaretPosition() > 0) {
...
voidsendKeyPress(JTextComponent target, int v_key, int modifiers)
Create and send a KeyPress KeyEvent to the component given
KeyEvent ke = new KeyEvent(target, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), modifiers, v_key,
        KeyEvent.CHAR_UNDEFINED);
target.dispatchEvent(ke);