• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable - Tabs jdk1.4

 
Martin S Webster
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a JTable I want to make the tab key move focus to the next component in a panel.
Currently, tab causes the next cell to retrieve focus - to move component you must press SHIFT_TAB, and to a previous component its CONTROL_SHIFT_TAB. Wow, maybe I should learn yoga to try to use some of these components. I need to make this a little more useable, as the users of the system are lorry drivers, whose hands are not the daintiest.
So.. in jdk 1.3 I just overrode isManagingFocus, return false. This worked fine.
We have migrated to jdk 1.4 and now have to call
setFocusCycleRoot(false). This however doesn't appear to work...

Any ideas? (apart from getting the lorry drivers to do yoga )
 
Martin S Webster
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I managed to hack a solution with
// jdk 1.4 feature
HashSet newKeys = new HashSet();
newKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0));
this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, newKeys);

HashSet backkeys = new HashSet();
backkeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,KeyEvent.SHIFT_DOWN_MASK));
this.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, backkeys);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!