AbstractTableModel Error

Hello!

I'm trying to build my own table. I'm using AbstractTableModel and implemented the required methods.
I got an error when writing a node's property, which can be seen above. What am I doing wrong?

@Override 
public node<> getValueAt(final int row, final int column) { 
  if (row == 0 && column >= 0) { return node.header[column]; } 
  if (row > 0 && column >= 0) { 
    ModelAccess.instance().runWriteAction(new Runnable() { 
      public void run() { 
        node.cells[row - 1].ColumnId = column; 
      } 
    }); 
    return node.cells[row - 1]; 
  } 
  return null; 
}
prettyPrint();
IllegalModelChangeError: registered node can only be modified inside undoable command or in 'loading' model [blocks] Block null[7254180275177669677] in BlockWithTable.sandbox.model

Regards
msch95
1 comment
As the error indicates, you should be using an undoable command - perhaps using executeCommandInEDT() could help here.

Vaclav
0

Please sign in to leave a comment.