com.justformspdf.pdf
Class FormRadioGroup

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

public class FormRadioGroup
extends FormElement

This class represents the Radio Group field of PDF Forms.

Radio buttons, like check boxes, allow a user to select one or more items from a list. The main difference between radio buttons and check boxes, as provided by Adobe Acrobat, is the appearance and the fact that at least one annotation for each Radio Button must be set.

Here is an example:

 
 FileInputStream fis = new FileInputStream("C:\\JustFormsPDF\\examples\\AddressForm32A2.pdf"); 
 PDF pdf = new PDF(new PDFReader(fis));
 Form form = pdf.getForm();
                   
 FormRadioGroup ethnic = (FormRadioGroup) form.getElement("ethnic");
 ethnic.setValue("ETH02");

 //ethnic.setValueByIndex(2);
 
 


Field Summary
 
Fields inherited from class com.justformspdf.pdf.FormElement
JUSTIFICATION_CENTER, JUSTIFICATION_LEFT, JUSTIFICATION_RIGHT
  
Constructor Summary
FormRadioGroup(java.lang.String name)
           
 
Method Summary
 void setValue(java.lang.String value)
          Select a radio button by matching the method argument value to Export Value of a button.
 void setValueByIndex(int index)
          Select a radio button by its index in the radio group/family.
 
Methods inherited from class com.justformspdf.pdf.FormElement
getName,getType,getRect,getValue,setReadOnly,isReadOnly
    

Constructor Detail

FormRadioGroup

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

setValueByIndex

public void setValueByIndex(int index)
                     throws java.lang.Exception
Select a radio button by its index in the radio group/family. To form a radio group for which single radio button selection has to be made, the radio button names in group should all be the same. There can be more than one radio groups in a PDF file.

Here is an example:

  
 FormRadioGroup ethnic = (FormRadioGroup) form.getElement("ethnic");
 ethnic.setValue("ETH02");
 //ethnic.setValueByIndex(2);
 

Parameters:
index - the index of selected radio button
Throws:
java.lang.Exception
See Also:
setValue(java.lang.String)

setValue

public void setValue(java.lang.String value)
              throws java.lang.Exception
Select a radio button by matching the method argument value to Export Value of a button. To form a radio group for which single radio button selection has to be made, the radio button names in group should all be the same. There can be more than one radio groups in a PDF file.

Here is an example:

  
 FormRadioGroup ethnic = (FormRadioGroup) form.getElement("ethnic");
 ethnic.setValue("ETH02");
 //ethnic.setValueByIndex(2);
 

Overrides:
setValue in class FormElement
Parameters:
value - form element value
Throws:
java.lang.Exception
See Also:
setValueByIndex(int)