• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable cell focus

 
MIRANGA_H
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
How do u loose the focus of a selected cell in a JTable ???
 
todd runstein
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic