com.justformspdf.pdf
Class FormComboBox
java.lang.Object
|
+--com.justformspdf.lib.PDFObjectImp
|
+--com.justformspdf.lib.PDFObjectGeneric
|
+--com.justformspdf.pdf.FormElement
|
+--com.justformspdf.pdf.FormChoice
|
+--com.justformspdf.pdf.FormComboBox
- All Implemented Interfaces:
- com.justformspdf.lib.PDFObject
- public class FormComboBox
- extends com.justformspdf.pdf.FormChoice
This class represents the Combo Box field of PDF Forms.
Combo boxes provide a list of items for selection. No matter how large a combo box is, it will only show the first item in the list, providing a scroll bar to access the other items.
Here is an example:
FileInputStream fis = new FileInputStream("C:\\JustFormsPDF\\examples\\AddressForm32A2.pdf");
PDF pdf = new PDF(new PDFReader(fis));
Form form = pdf.getForm();
FormComboBox suffix = (FormComboBox) form.getElement("Suffix");
suffix.setValueByIndex(5);
Method Summary |
void |
setValue(java.lang.String value)
Set value of this form element. |
void |
setValueByIndex(int index)
Select a particular value of combo box by the index of (item, value) pairs in the combo box. |
FormComboBox
public FormComboBox(java.lang.String name)
setValue
public void setValue(java.lang.String value)
throws java.lang.Exception
-
Set value of this form element. (Method inherited from class com.justformspdf.pdf.FormElement)
This method is applibale to all the form elements FormText, FormCheckBox, FormComboBox, FormButton and FormRadioGroup.
Here is an example:
FormComboBox suffix = (FormComboBox) form.getElement("Suffix");
suffix.setValue("5");
-
- Overrides:
setValue
in class FormElement
-
- Parameters:
value
- form element value
- Throws:
java.lang.Exception
- See Also:
-
setValueByIndex(int)
setValueByIndex
public void setValueByIndex(int index)
throws java.lang.Exception
-
Select a particular value of combo box by the index of (item, value) pairs in the combo box. Each (item, value) pair in the combo box are inserted as Item (which is visible) and an associated Export Value (which is hidden and is submitted on submission of the form)
Here is an example:
FormComboBox suffix = (FormComboBox) form.getElement("Suffix");
suffix.setValueByIndex(5);
-
- Parameters:
index
- the index of selected combo box value
- Throws:
java.lang.Exception
- See Also:
-
setValue(java.lang.String)