• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

handling TAB in JTable celleditor

 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Does anyone know how I can stop a tablecelleditor from losing focus when the tab key is pressed? I have an editor which contains 2 combo boxes. I want to switch between those 2 combos when pressing tab. At the moment the focus of the editor is lost. How can I fix this?
 
Author
Posts: 979
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Manuel Moons wrote:
Does anyone know how I can stop a tablecelleditor from losing focus when the tab key is pressed? I have an editor which contains 2 combo boxes. I want to switch between those 2 combos when pressing tab. At the moment the focus of the editor is lost. How can I fix this?



By default JTable has an action bound to the tab key. I don't know if this will work, but you can try removing that binding:



Here the string "do-nothing" can be anything so long as it doesn't match anything in the action map. (So "selectNextColumnCell" would be a poor choice.)
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey thanks,

I actually already came up with that solution myself. It worked. I attached a custom action to my cellEditor component and by doing that I made sure that it (the key) will not be forwarded to the table. So for other editors it will still work and I can handle my own TAB key.

 
reply
    Bookmark Topic Watch Topic
  • New Topic