首先,您必须在模型中将数据保存为布尔值.所以你应该用它rs.getBoolean("Fanta")
代替rs.getString("Fanta").trim()
.
其次,你必须覆盖你的public Class getColumnClass(int column)
方法JTable
.您的代码可能如下所示:
JTable orderResults = new JTable() { @Override public Class getColumnClass(int column) { // first 5 columns will be represented as an checkbox if(column <= 4){ return Boolean.class; } // rest of them as a text return String.class; } };