1、做一个modelpublic class DataTableModel extends AbstractTableModel2、实现
    /**
     * Returns true if the cell at rowIndex and columnIndex is editable.
     * Otherwise, setValueAt on the cell will not change the value of that cell.
     *
     * @param row - The row whose value to be queried.
     * @param col - The column whose value to be queried.
     * @return boolean - True if the cell is editable.
     */
    public boolean isCellEditable(int row, int col)3、引用
DataTableModel model = new DataTableModel();
jTable1.setModel(model);以上是个人的做法!请指正!

解决方案 »

  1.   

    如上,定义一个boolean数组 editables,
    在public boolean isCellEditable(int row, int col)里这样:
    return editables[col];
      

  2.   

    boolean[] editables = {true, true, false, false, true};
    public boolean isCellEditable(int row, int col)
    {
        return editables[col];
    }
    这样就定义了第2,3列不可编辑,第0,1,4列可编辑
      

  3.   

    为什么不用一个公用MODEL类来做呢?
    想怎么设就怎么设