This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Pressing Tab enter JTable, pressing Tab again exit JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Pressing Tab enter JTable, pressing Tab again exit JTable" Watch "Pressing Tab enter JTable, pressing Tab again exit JTable" New topic
Author

Pressing Tab enter JTable, pressing Tab again exit JTable

Ling Chung
Ranch Hand

Joined: Mar 29, 2004
Posts: 39
hello all,
i have a few fields in a panel and by pressing tab i go through them as i want it to, but beneath this panel is JTable when i enter this table upon pressing Tab it goes further by setting focus to each column and expanding to the next row if you keep pressing Tab. I would like to set focus only once to the first row of the Table and then next Tab will be exit JTable and set focus again to the fields in my panel.
How can this be accomplished?
Thanks a lot!!!
Fuqiang Zhao
Greenhorn

Joined: Jan 07, 2004
Posts: 24
table.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
table.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
null);
table.setFocusCycleRoot(false);
Ling Chung
Ranch Hand

Joined: Mar 29, 2004
Posts: 39
Thanks a lot this is exactly what i needed.
But now it selects the first cell in the table but how can i make it to select the entire row when focus is on the table when TAB is pressed?
Thanks for the help!!
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Pressing Tab enter JTable, pressing Tab again exit JTable