• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tabbing in and out of JTable

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Once I press 'Tab' and enter the JTable, I am unable to come out of the JTable component.
(subsequent pressing of the 'Tab' key just takes me from cell to cell). I want to disable this feature of JTable, so that pressing the Tab key takes me to the next component.
Would it be possible to do this without implementing a key listener for the JTable? Any other ideas?
Thanks,
Venita
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Venita,
I sweated over that too, but decied not to change that behavior. You can still move between components with CTRL+TAB.
If you want to change it though, there is a method called installKeyboardActions() in the BasicTableUI class which extends TableUI. You can get the JTable's UI by calling getUI().
Hope this helps,
Michael Morris
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


subsequent pressing of the 'Tab' key just takes me from cell to cell


Some people here pointed out that this is how it should be. To tab out of JTAble, the user presses CTL-TAB, as Michael said. I tried tabbing in JBuilder, for example, and sure enough, that's how it behaves, -- if the focus is on the list box or table, tabbing will move the focus to the next item in the control.
Eugene.
 
Venita Glasfurd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the replies, Michael and Eugene.
I realise that if I override installKeyboardActions in the BasicTableUI, it would block all other keyboard actions on the table.
I just thought that it would be nice to disable Tab within Jtable, since I don't want to move from cell to cell anyway - Though now I'm beginning to wonder if it is worth the effort, since one can use control+Tab to move between components, as pointed out.
Will remember to put this 'Ctrl+Tab' point down in my user manual documentation.
Venita.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Venita,


Will remember to put this 'Ctrl+Tab' point down in my user manual documentation.


That's how I handled it.
Michael Morris
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic