How to make JTable column contain checkboxes?

后端 未结 5 2064
走了就别回头了
走了就别回头了 2020-12-20 15:53

Preface: I am horrible with java, and worse with java ui components.

I have found several different tutorials on how to add buttons to tables, however I am strugglin

5条回答
  •  被撕碎了的回忆
    2020-12-20 16:47

    As Peter say, its easy using extended DefaultTableModel class, ex:

    class NewTableModel extends DefaultTableModel{
            public Class getColumnClass(int columnIndex) {
                return getValueAt(0, columnIndex).getClass();
            }
        }
    

提交回复
热议问题