com.justformspdf.pdf
Class FormCheckbox

java.lang.Object
  |
  +--com.justformspdf.lib.PDFObjectImp
        |
        +--com.justformspdf.lib.PDFObjectGeneric
              |
              +--com.justformspdf.pdf.FormElement
                    |
                    +--com.justformspdf.pdf.FormCheckbox
All Implemented Interfaces:
com.justformspdf.lib.PDFObject

public class FormCheckbox
extends FormElement

This class represents the Check Box field of PDF Forms.

Check boxes allow a user to select one or more items from a list. In the same way as the HTML Check Box works, a PDF check box can be either "checked" or "un-checked".

Here is an example:

  
 
 FileInputStream fis = new FileInputStream("C:\\JustFormsPDF\\examples\\AddressForm32A2.pdf"); 
 PDF pdf = new PDF(new PDFReader(fis));
 Form form = pdf.getForm(); 
 FormCheckbox addressType = (FormCheckbox) form.getElement("AddressTypePerm");
 addressType.check(true);
 
 


Field Summary
 
Fields inherited from class com.justformspdf.pdf.FormElement
JUSTIFICATION_CENTER, JUSTIFICATION_LEFT, JUSTIFICATION_RIGHT
   
Constructor Summary
FormCheckbox(java.lang.String name)
           
 
Method Summary
 void check(boolean flag)
          Check or uncheck the checkbox.
 void setValue(java.lang.String value)
          Set value of this form element.
 
Methods inherited from class com.justformspdf.pdf.FormElement
getName,getType,getRect,getValue,setReadOnly,isReadOnly
    

Constructor Detail

FormCheckbox

public FormCheckbox(java.lang.String name)
Method Detail

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:

   
 FormCheckbox addressType = (FormCheckbox) form.getElement("AddressTypePerm");
 addressType.setValue("Yes");
 //addressType.setValue("Off");
 
 

Overrides:
setValue in class FormElement
Parameters:
value - form element value ("Yes" or "Off")
Throws:
java.lang.Exception
See Also:
check(boolean)

check

public void check(boolean flag)
           throws java.lang.Exception
Check or uncheck the checkbox.

Here is an example:

   
 FormCheckbox addressType = (FormCheckbox) form.getElement("AddressTypePerm");
 addressType.check(true);
 
 

Parameters:
flag - check/uncheck flag true = check, false = uncheck
Throws:
java.lang.Exception
See Also:
setValue(java.lang.String)