Hello
i get java.lang.ArrayIndexOutOfBoundsException
and i don't understand it why...
code open only one table (6 rows and 6 columns), all anothers show this exception.
structure of all tables equals. Different rows only
i put in code strings
System.out.println("====Element=== "+ud.columns[2].elementAt(0));
System.out.println("====Element=== "+ud.columns[3].elementAt(0));
for test. they showing right data...
so why tables show this exception ?
code is
public void setDataModel(UserData ud)
{
this.ud=ud;
this.cols=ud.cols;
this.rows=ud.columns[0].size();
this.columnnames=ud.columnnames;
this.columntypes=ud.columntypes;
this.usertable=null;
this.usertable=new Object[cols][rows];
System.out.println("cols="+cols+" rows="+rows);
for (i=0;i<rows;i++)
{
for (j=0;j<cols;j++)
{
System.out.println("====Element=== "+ud.columns[2].elementAt(0));
System.out.println("====Element=== "+ud.columns[3].elementAt(0));
System.out.println("i="+i+" j="+j);
usertable[i][j]=ud.columns[j].elementAt(i);// <- here is exception
System.out.println("element="+usertable[i][j]);
}
}
}
public int getColumnCount()
{
return (cols);
}
public String getColumnName(int cols)
{
return (columnnames[cols]+"\n"+columntypes[cols]);
}
public int getRowCount()
{
return (rows);
}
public Object getValueAt(int rows,int cols)
{
return (usertable[rows][cols]);
}