确定TableColumn的数据类型

时间:2015-06-09 09:26:34

标签: java tablecolumn

例如我有这个随机表:
enter image description here

如何确定每列的数据类型:
第一列包含String类型的数据 第二列包含Double类型的数据 第三列包含String类型的数据。

1 个答案:

答案 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);