TableModel setCellEditable and automatically setting the value back to false

前端 未结 1 1087
春和景丽
春和景丽 2021-01-24 19:35

I\'m currently trying to implement a JPopupMenu in my JTable that allows the unlocking of a cell for editing using

@Override 
public void actionPerformed(ActionE         


        
1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-24 20:12

    but where in my code should I change the cell back to uneditable when focus is lost? -

    You could:

    1. override the setValueAt(...) method of your TableModel to make a cell uneditable once the data is changed.

    2. use a TableModelListener It will generate an event when the data of a cell is updated.

    0 讨论(0)
提交回复
热议问题