Hello,
I try to build a TablePane dynamically but it doesnt work !
As if the table had no rows and no columns.
Someone could help me to find the error.
Thanks
Trace :
nbCol: 3
nbLigne: 4
Rows: 4
Columns: 3
i: 2
j: 1
and the error :
java.lang.IndexOutOfBoundsException: index 1 out of bounds.
at
org.apache.pivot.collections.ArrayList.verifyIndexBounds(ArrayList.java:577)
at
org.apache.pivot.collections.ArrayList.get(ArrayList.java:346)
at
org.apache.pivot.wtk.TablePane$Row.update(TablePane.java:221)
at
org.apache.pivot.wtk.TablePane.setCellComponent(TablePane.java:914)
at
applet.Principale.buildHautDroit(Principale.java:552)
TablePane hautDroit = new TablePane();
int nbCol = cb.getNbColonne();
int nbLigne = cb.getNbLigne();
System.out.println("nbCol: " + nbCol);
System.out.println("nbLigne: " + nbLigne);
for (int j=0; j<nbCol; j++) { hautDroit.getColumns().add(new
TablePane.Column(1, true)); }
for (int i=0; i<nbLigne; i++) { hautDroit.getRows().add(new TablePane.Row(1,
true)); }
System.out.println("Rows: " + hautDroit.getRows().getLength());
System.out.println("Columns: " + hautDroit.getColumns().getLength());
ImageView im;
for (int i=0; i<nbLigne; i++) {
for (int j=0; j<nbCol; j++) {
if (cb.getCase(i, j)!=null) {
System.out.println("i: " + i);
System.out.println("j: " + j);
im = new ImageView(Image.load(cb.getCase(i,
j).getVin().getImgCouleur()));
im.getUserData().put(String.valueOf(i) +
String.valueOf(j), cb.getCase(i, j));
==è Error hautDroit.setCellComponent(i, j, im);
}
}
}
--
Cordialement
Jérôme Serré