How to disable edit cell in JTable (especially in NetBeans)

Put this in your code:

table = new javax.swing.JTable(){

    public boolean isCellEditable(int rowIndex, int colIndex) {

        return false;   //Disallow the editing of any cell

    }

};


where table is the name of your JTable.

For NetBeans users:
1. select the table GUI, right click, select Customize Code
2. Your code should look like this:

http://1.bp.blogspot.com/_EfGL73bJsZA/TD_OIbauLhI/AAAAAAAAAiI/4_ebhKlvtNo/s400/untitled.bmp