| Author |
Transfer Focus From JTable To Other Component
|
Syed Muhammad Mubashir Ahmed
Greenhorn
Joined: May 20, 2012
Posts: 2
|
|
|
How I transfer focus from jtable to other component usiing tab or shift tab keys.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4163
|
|
|
The standard keyboard shortcut for that is Ctrl+Tab / Ctrl+Shit+Tab. Why do you want to confuse a user who's accustomed to Tab and Shift+Tab behaving in a standard way?
|
luck, db
There are no new questions, but there may be new answers.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
I think the problem is that Tab / Shift+Tab start behaving differently when the focus comes to a JTable. For just about every other component, Tab gives focus to the "next" component and Shift+Tab gives focus to the "previous" component. When a JTable has focus, Tab and Shift+Tab change cell selection all of a sudden. I myself actually find that a bit annoying.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4163
|
|
When a JTable has focus, Tab and Shift+Tab change cell selection all of a sudden. I myself actually find that a bit annoying.
What about tabbing out of a text component? It's the same there. This has been the normal behavior on GUI platforms that long predated Swing or Java. Screen elements that accept Tab require Ctrl+Tab to move to the next element in the tab order.
The behavior can probably be easily modified by getting the key binding for Ctrl+Tab and mapping it to Tab, in the WHEN_FOCUSED (and maybe WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, to cater to the editing state) map(s). As a user accustomed to using Tab / Shift+Tab to move to the next/previous cells not only in a GUI table, but also in just about any spreadsheet software, I might find that annoying
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Darryl Burke wrote:What about tabbing out of a text component? It's the same there.
And it can be just as annoying And in a few projects where tabs weren't allowed in text components, I have indeed changed the default behaviour to switch focus instead.
|
 |
 |
|
|
subject: Transfer Focus From JTable To Other Component
|
|
|