Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable, JTextField and focus

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?

Paper has not yet been outlawed – so let your Java Swing application print with wild abandon: JPDF
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic