How can I set focus to a particular table's cell?
Thanks
Printable View
How can I set focus to a particular table's cell?
Thanks
Hello,
you can select a cell in a table, and you can edit that cell. If you edit that cell, the celleditor of it get the focus and the table lost the focus. If you just select the cell, the table has the focus but the cell is selected.
You can select cells with the following methods:
setColumnselectionInterval(int, int)
setRowSelectionInterval(int, int)
and you can edit a cell by the following method:
editCellAt(int iColumn, int iRow)
Greetings
Ting.
Thanks for your reply! It works.
How can I cancel the focus of a particular cell?
Suppose that when user click a particular cell, I will show
a dialog.
After that, I want to cancel the focus of this cell.
How can I achieve it?
Hello,
to cancel the selection, use the methode
JTable.clearSelection();
To cancel the editing, use the methode
JTable.getCellEditor().stopCellEditing();
Greetings.
Ting.
Thanks a lot!
It works