Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable Tabbing

 
G Estes
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> What would you suggest as the best approach...

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

 
G Estes
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was a good thought, but made no impact. Almost like I need to fire an event to trigger edit mode maybe?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic