我有JTable的问题。我需要编辑一些行,但是当我完成并按ENTER键时,我想要像在数据库中保存一样进行更改操作。这是我的代码:
// JTable PDV
tablePDV = new JTable(pdvTableModel) {
// Editable Enable || Disable
public boolean isCellEditable(int rowIndex, int colIndex) {
if (check == true) {
if (rowIndex == rowSelectedIndex
&& colIndex == colSelectedIndex) {
return super.isCellEditable(rowIndex, colIndex);
}
}
return false;
}
};
tablePDV.addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent arg0) {
tablePDV.clearSelection();
tablePDVSecond.clearSelection();
}
@Override
public void mouseClicked(MouseEvent e) {
tableMousClick(tablePDV, e, 436, 455, 477, 498, 1);
}
});