Input/action map prob on JTextComponent



Hello,

I use the following code to assign key strokes to actions to be
performed:

Action act = new ... (whatever)
JTextComponent tc = new ... (some standard text component)

Object key = action.getValue(Action.NAME);

tc.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
0), key); <--- not working!
tc.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
KeyEvent.CTRL_DOWN_MASK), key);
tc.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("alt
S"), key);

tc.getActionMap().put(key, caSend);

There's nothing basically wrong with the above code. When entering
something into the text component, the action atop is performed on Alt-
S or Ctrl-ENTER, however it is *NOT* performed when not using a
modifier. Might have to with the component being a text component. ->?

Why doesn't it work?

How do I make it work?

That text component is supposed to be single lined, but resizability
simply looks better with the app...

I've just tried using a JTextField instead and the RETURN only
keystroke *works*. Does anyone know why the former styled text pane/s
don't?

Karsten
.