// Recover the next form field to process:
AbstractField field = (AbstractField) i.next();
// Recover its name (common feature to all the form fields):
String fieldname= field.getName();
// At this stage you will have to check the type of form field:
if (if (field instanceof CheckBoxField)
{
System.out.println("Updating the value of the Check Box Field name " + fieldname);
CheckBoxField cb = (CheckBoxField) field;
cb.setValue("true");
}
else if (field instanceof TextField)
{
System.out.println("Updating the value of the Text Field name " + fieldname);
TextField tf = (TextField) field;
tf.setValue("My New Value");
}
else if (field instanceof RadioButtonField)
{
System.out.println("Updating the value of the Radio Button Field name " + fieldname);
RadioButtonField rb = (RadioButtonField) field;
rb.setValue("true");
}
// jPDF defines many other types of fields. just look in the javadoc for
// children of AbstractField: