This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
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
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
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.
Joined: Sep 11, 2002
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.
Joined: Jan 30, 2002
Will remember to put this 'Ctrl+Tab' point down in my user manual documentation.