JTable custom cell renderer focus problem

妖精的绣舞 提交于 2019-12-01 06:21:01

So your problem is, that you are still editing the cell. So you have to stop the editing and then the cell will be changed.

At your button you can get the cell who is being edited with
TableCellEditor cellEditor = table.getCellEditor();
then you can stop the editing with
if(cellEditor!=null){
cellEditor.stopCellEditing();
}

and then you can save the value

kleopatra

Tell the table to automatically commit when losing focus:

table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!