This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • 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: 22004
107
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: 22004
107
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.
 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic