【发布时间】:2018-10-30 14:11:39
【问题描述】:
我试图从 GUI 中通过单击从 JTable 中选择我的行。我选择得很好,但是当我尝试删除某些内容时,我得到 java.lang.ArrayIndexOutOfBoundsException: 2>=1
if(row >= 0)
{
String id = table_1.getModel().getValueAt(row, 0).toString(); // here I got the error
int idd = Integer.parseInt(id);
Account account = bank.getAccounts().get(idd);
bank.removeAccount(account);
}
我该如何解决??
【问题讨论】:
-
是什么决定了变量row的值?它应该类似于:
row = table_1.getSelectedRow();.
标签: java jtable indexoutofboundsexception