Hi,
I am not sure how to use a zk Hbox Array. I am trying to create an array of ZK Hbox components and use it within a for block.
void createRow(Component container, final Node fieldNode, FieldCreator [] fieldDescription) {
final Vbox fieldsRows = new Vbox();
final Hbox fieldsRow = new Hbox();
final Hbox[] fieldBox;
int i=0;
for (FieldCreator fieldDesc : fieldDescription) {
fieldBox[i] = new Hbox();
fieldDesc.createField(fieldNode, fieldBox[i]);
i++;
}
fieldsRow.appendChild(fieldBox[]);
Button removeFieldButton = new Button(Messages.getString("MXFC_removeFieldButton")); //$NON-NLS-1$
fieldsRow.appendChild(removeFieldButton);
fieldsRows.appendChild(fieldsRow);
removeFieldButton.addEventListener(Events.ON_CLICK, new EventListener() {
public void onEvent(Event event) throws Exception {
fieldNode.getParentNode().removeChild(fieldNode);
fieldBox[].setParent(null);
}
});
container.appendChild(fieldsRows);
}
The code above is incorrect. The compiler throws the error: "Syntax error on token "[", Expression expected after this token." on lines :
fieldsRow.appendChild(fieldBox[]);
fieldBox[].setParent(null);
How do I fix this?
Thanks, Sony