How can I request the focus for a specific cell of a table?
This code does not work:
((DefaultTableCellRenderer)table.getCellRenderer(row,column)).requestFocusInWindow()
(returns false)
Btw.:
((DefaultTableCellRenderer)table.getCellRenderer(row,column)).isDisplayable()
returns false and
((DefaultTableCellRenderer)table.getCellRenderer(row,column)).isVisisble()
returns true...
Thanks in advance,
Stephan Collet

Signature
Viele Grüße,
Stephan Collet
Walter Probst - 11 Feb 2005 11:08 GMT
> How can I request the focus for a specific cell of a table?
You need to set the row and column selection anchor.
jTable.getSelectionModel().setAnchorSelectionIndex(selectedRow);
jTable.getColumnModel().getSelectionModel().setAnchorSelectionIndex(selectedColumn);
Babu Kalakrishnan - 12 Feb 2005 04:03 GMT
> How can I request the focus for a specific cell of a table?
>
[quoted text clipped - 10 lines]
> ((DefaultTableCellRenderer)table.getCellRenderer(row,column)).isVisisble()
> returns true...
A JTable is a single component (at least when it isn't editing), and the
"focus" concept does not work at a cell level since each cell is not a
child component of the table.
The nearest thing you could do is what another poster suggested - i.e.
set the cell you want as the selected cell in the table.
BK