JTable not losing focus on ENTER and TAB
-
30-06-2021 - |
Question
table.changeSelection(table.getRowCount()-1, 3, false, false);
after setting the cell selection like above, the cell is selected and if i enter the value in to the cell, the cell goes to editing mode. But, after the value is entered, if i press ENTER or TAB key the cell is still in editing mode. If i press some where on other component then only the cell closes editor mode.
how to solve this?
Solution
after setting the cell selection like above, the cell is selected and if i enter the value in to the cell, the cell goes to editing mode
for better help sooner post an SSCCE demonstraded your issue about
table.changeSelection
andTableCellEditor
have to override
stopCellEditing
depends of your TableCellEditor
table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
or
@Override
public boolean stopCellEditing() {// @see CellEditor#stopCellEditing()
fireEditingStopped();
return true;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow