• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable, JTextField and focus  RSS feed

Stefan Krompass
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a JTable with cells backed by JTextFields:

Now I want the user to be able to enter text in the focused/selected
textfield simply by tabbing to that cell.
How can I cause editing to commence immediately when the user navigates
to a cell with the keyboard?
I have already tried several solutions:
- Calling requestFocus() on prev.getNext() (see above, second for-loop)
- Calling requestFocusInWindow() on prev.getNext() with the result that the requestFocusInWindow-method returns false
- Calling transferFocus() had no effect
- Calling DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent() had no effect either.

Can anybody help me?

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!