【发布时间】:2015-03-02 21:36:48
【问题描述】:
我想知道如何将选定的 JTable 行放入模型中。
现在我得到了类似的东西。
int selectedRowIndex = tabelSpelers.getSelectedRow();
int selectedColumnIndex = tabelSpelers.getColumnCount();
Object[] tableData = new Object[selectedColumnIndex];
for (int j = 0 ; j < selectedColumnIndex; j++){
tableData[j] = tabelSpelers.getValueAt(selectedRowIndex,j);
}
Speler selectedSpeler = (Speler) tableData;
JOptionPane.showMessageDialog(this, tableData);
模型如下所示:
public Speler(int speler_id, String voornaam, String achternaam, String adres, String postcode, String woonplaats, String telefoonnummer, String email, int rating, boolean isBekend)
【问题讨论】:
-
你的模型类是什么样子的?
标签: java model-view-controller casting model jtable