例如我有这个随机表:
如何确定每列的数据类型:
第一列包含String类型的数据
第二列包含Double类型的数据
第三列包含String类型的数据。
答案 0 :(得分:0)
尝试以下...
//creating a table
MyTableModel mod = new MyTableModel(data, columnNames);
JTable table = new JTable(mod);
table.setVisible(true);
table.getColumnClass(1); // will return the data type class of first column
table.isCellEditable(1, 0);