Detect Data Change

Report a typo

What code should be added to the setValueAt method in order to fire the fireTableCellUpdated event at rowIndex and columnIndex?

class MyTableModel extends AbstractTableModel {
    String[] columns = {"Employee Name" , "Job Title" , "Salary"};
    Object[][] data = {{"Bob" , "Programmer" , 19000} , {"Alice" , "Programmer" , 19000}};

    @Override
    public int getRowCount() {
        return data.length;
    }

    @Override
    public int getColumnCount() {
        return columns.length;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        return data[rowIndex][columnIndex];
    }

    public void setValueAt(Object value, int rowIndex, int columnIndex) {
        data[rowIndex][columnIndex] = value;
        ______________________________________
    }
}
Enter a short text
___

Create a free account to access the full topic