JAVA jTable - How to make all cells non-editable?

Cristian picture Cristian · Jan 15, 2011 · Viewed 20.6k times · Source

I have a jTable calendar that works just fine and I just want the user not be able to edit anything. How can I do it?

Thanks a lot!!

PS: I use netbeans 6.9.

Answer

imanzi picture imanzi · Mar 16, 2013
DefaultTableModel tableModel = new DefaultTableModel() {

    @Override
    public boolean isCellEditable(int row, int column) {
        //all cells false
        return false;
    }
};

table.setModel(tableModel);