Hello,
I was trying to build a panel using the JGoodies Forms. I followed the WhitePaper document that was included and have looked over various other examples and I am not sure what I am doing wrong. Here is my code:
private void buildPanel(){
initComponents();
FormLayout layout =
new FormLayout("left:pref, center:pref:grow, left:pref, right:pref", " ");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
for (int i = 0; i < modelProgress.length; i++){
builder.append(modelNumber);
builder.append("");
if ((i+1)%2 == 0){
builder.nextLine();
builder.append(modelProgress[i-1]);
builder.append("");
builder.append(modelProgress[i]);
builder.nextLine();
}
if ((i+1)== modelProgress.length && (i+1)%2 != 0){
builder.nextLine();
builder.append(modelProgress[i]);
builder.nextLine();
}
}
builder.nextLine();
// error is directing me to below line.
builder.append("");
builder.append(overallProgress);
builder.nextLine();
builder.append("");
builder.append("", time);
builder.nextLine();
builder.append("");
builder.append("");
builder.append("", cancel);
this.add(builder.getPanel());
}
and I am getting this error:
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: The row index 14 must be less than or equal to 13.
at com.jgoodies.forms.layout.CellConstraints.ensureValidGridBounds(CellConstraints.java:962)
at com.jgoodies.forms.layout.FormLayout.setConstraints(FormLayout.java:822)...
It points me to the commented line. I think it may be with my FormLayout? I want to have 4 colums and however many rows are necessary based on the modelProgress.length. Or does it not like me appending ""?
Any help is greatly appreciated.