aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTable cell focus Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable cell focus" Watch "JTable cell focus" New topic
Author

JTable cell focus

MIRANGA_H
Greenhorn

Joined: Jan 27, 2005
Posts: 13
HI,
How do u loose the focus of a selected cell in a JTable ???
todd runstein
Ranch Hand

Joined: Feb 15, 2005
Posts: 64
I don't understand? Do you want to put the focus somewhere else (click on another component)? Do you want to know when the cell loses focus (add a listener)? Perhaps you could explain a bit more about what you're trying to do?
Lilyana Saputra
Greenhorn

Joined: Feb 03, 2006
Posts: 20
i think that he want to know is ...
how to move the focus from table to other component...

because i have same problem with that!!!

thx
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Some possibilities might be:
1 — use JTable methods
table.clearSelection, table.changeSelection or perhaps any of several methods available in the tables ListSelectionModel obtained by table.getSelectionModel or table.getColumnModel.getSelectionModel
how to move the focus from table to other component...
2 — work with the focus subsystem
information and examples on focus control for j2se 1.4+ How to Use the Focus Subsystem in the tutorial
and The AWT Focus Subsystem in the javadocs
3 — work with the KeyboardFocusManager
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager
and calling methods like kfm.focusNextComponent and kfm.focusPreviousComponent
4 — use default LAF focus traversal with the tab key
try pressing the tab and control keys to leave the JTable.

edit - typos
[ February 28, 2006: Message edited by: Craig Wood ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JTable cell focus