The porblem is that even I change cell value to the same exact value it counts as a change. So for example if I double click a cell and don't change its value my program proceeds to write it to the server.
How can I make that only cells that have their values changed, for instance (x -> y)
write to server. (x -> x)
do nothing.
Code below:
Misc_Table.getModel().addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent e) {
int row = e.getFirstRow();
int col = e.getColumn();
Doo.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
try{
Object value = model.getValueAt(row, col);
int selected = (int) Functions_ComboBox.getSelectedIndex();
if(selected == 0){
String val = (String) value;
int int_Val = Integer.parseInt(val);
BackEnd.WriteMultiple_16Bit(unitID, row, int_Val , 1);
}
} catch (NumberFormatException e1) {
JOptionPane.showMessageDialog(MISC,"Wrong number format.");
} catch (Exception e2) {
}
}
});
}
});