wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JTable Tabbing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable Tabbing" Watch "JTable Tabbing" New topic
Author

JTable Tabbing

G Estes
Ranch Hand

Joined: Oct 22, 2002
Posts: 62
What would you suggest as the best approach to making the Shift+Tab move backward through the editable fields in a JTable (as is the behavior in MS Excel)? This would also mimic the the behavior on a panel with tab order set among text fields and buttons...the Shift+Tab will move backward through the order.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> What would you suggest as the best approach...

best? doubtful, but seems to work OK (limited testing)

G Estes
Ranch Hand

Joined: Oct 22, 2002
Posts: 62
Thanks for the response. Our JTable has several custom renderer/editors and while I can see that the selection is happening (i.e. I Shift+Tab then type and the text goes into the correct cell), the editor is not coming up on entry - as it does doing a normal Tab action. Any suggestions as to what may be different here?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> Any suggestions as to what may be different here?

in the source code for JTable, in processKeyBinding(..) the event is passed
to the editor component.

perhaps this addition might be enough

table.changeSelection(row, column, false, false);
table.editCellAt(row,column);//<-------------
G Estes
Ranch Hand

Joined: Oct 22, 2002
Posts: 62
That was a good thought, but made no impact. Almost like I need to fire an event to trigger edit mode maybe?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable Tabbing