• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Transfer Focus From JTable To Other Component

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How I transfer focus from jtable to other component usiing tab or shift tab keys.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
    Bookmark Topic Watch Topic
  • New Topic