Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

JTable, JTextField and focus

Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

I don't always make ads but when I do they're tiny
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic