JTable custom cell renderer focus problem

后端 未结 2 1285
一整个雨季
一整个雨季 2021-01-13 17:38

I have a table like this. The second column uses a JTextField renderer and the third column uses a JPasswordField based renderer and editor.

2条回答
  •  花落未央
    2021-01-13 18:45

    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

提交回复
热议问题