i am having a problem with jtable which i was unable to solve for a
last couple a days. i think there needs to be much more docs on some
tricky uses of jtable than basic JTable/TableModel usage. so far i
managed to move to the next cell when i press enter (right hand side,
instead of moving down).
i'd like to start editing in the next cell after moving from previous
cell. so, if i was in editing mode in some cell, enter should bring me
to the next cell with caret blinking in it. of course, if i wasn't
editing some cell i don't want to edit next cell.
basicly, i want to make "row edit session", for example user starts
editing a cell with f2, and as long as he press enter he edits next
cell, until he reaches the end of the row and then changes are
commited to database, just like M$Access and SQLserver does. i think i
can do this myself, all i need is little help to start edit next cell
if user moves from previous cell. i checked BasicTableUI source, and
as i see i should get the editor component and request focus on it.
but i am stuck with that.
thanks!
Kleopatra - 25 Nov 2003 16:21 GMT
> i am having a problem with jtable which i was unable to solve for a
> last couple a days. i think there needs to be much more docs on some
> tricky uses of jtable than basic JTable/TableModel usage. so far i
> managed to move to the next cell when i press enter (right hand side,
> instead of moving down).
just wondering - how did you do it? I'm asking because if you do it the
swing way (manipulate inputMap/actionMap) then you are halfway through
with your other requirement ...
> i'd like to start editing in the next cell after moving from previous
> cell. so, if i was in editing mode in some cell, enter should bring me
> to the next cell with caret blinking in it. of course, if i wasn't
> editing some cell i don't want to edit next cell.
... wrap the appropriate navigational actions registered for the table
with custom actions that
a) check if the table is editing
b) call the original
c) start editing at the new cell if a) returned true.
and replace the original actions in the actionMap with your wrappers.
Greetings
Jeanette