【发布时间】:2018-07-30 20:12:45
【问题描述】:
我刚刚在 java 中创建了一个简单的表,我正在尝试获取行内的数据
ArrayList<Object> s = new ArrayList<Object>();
private void get_valuesActionPerformed(java.awt.event.ActionEvent evt)
{
for (int i = 1; i <= mod.getRowCount(); i++)
{
for (int j = 1; j <= mod.getColumnCount(); j++)
{
System.out.println(mod.getValueAt(i,j));
//System.out.println("row= "+i+"column= "+j);
}
}
}
当我计算和打印行和列时,它可以工作,
但是当使用getValue()method 时,会出现以下异常:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
我有列(名称,密码),为什么会出现这个异常?,我应该怎么做才能获取数据?
【问题讨论】:
标签: java jtable indexoutofboundsexception