Answer the question
In order to leave comments, you need to log in
Why doesn't CellEditorListener work?
Hello! Actually the question I think is clear.
/**
* Creates new form mainFrame
*/
public mainFrame() {
initComponents();
initCellEditor();
}
/**
* Инициализация обработчика редактирования ячейки
*/
private void initCellEditor() {
javax.swing.DefaultCellEditor editor = new javax.swing.DefaultCellEditor(new javax.swing.JTextField());
editor.addCellEditorListener(new CellEditorListener() {
@Override
public void editingStopped(ChangeEvent e) {
int indexCol = tableData.getSelectedColumn();
int indexRow = tableData.getSelectedRow();
double value = Double.parseDouble(tableData.getValueAt(indexRow, indexCol).toString());
javax.swing.JOptionPane.showMessageDialog(rootPane, "Выбрана ячейка по значением: " + value);
}
@Override
public void editingCanceled(ChangeEvent e) {
// pass
}
});
this.tableData.setCellEditor(editor);
}
Answer the question
In order to leave comments, you need to log in
And what prevents you from catching changes in the TableModel using the TableModelListener?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question