Best Regards
Thorsten
> I want to use a TextArea as TableCellRenderer.
I've never tried to use a TextArea in a JTable, but JTextField and
JTextArea work. You'll want a renderer, but you'll also need an editor
to implement TableCellEditor and have it return whichever component you
decide to use:
<http://java.sun.com/docs/books/tutorial/uiswing/components/table.html>
> The problem is when I press "enter", editing is canceled.
> And when I use the arrow keys, editing is also canceled.
> How can I prevent cancelation.
When you click on a JTextField or JTextArea, i.e. when either has focus,
the keys will work according to the defaults specified in the current
look & feel (L&F). You can change a key's binding as desired:
<http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html>
Here's a nice tool for exploring the default key bindings and Action
names found in a particular L&F:
<http://www.camick.com/java/source/KeyBindings.java>
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
> I want to use a TextArea as TableCellRenderer.
TextArea or JTextArea?
> The problem is when I press "enter", editing is canceled.
> And when I use the arrow keys, editing is also canceled.
> How can I prevent cancelation.
That is presumably because the textarea does not get focus, so the
JTable handles these key events instead of the textarea.
If you use *just* a textarea, see
JTable.setSurrendersFocusOnKeystroke
(or similar name)
If you use a textarea in a JScrollPane etc., it gets more complicated.