Example: The following example shows how to create an Radio Button and Add it to the page.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.forms.RadioButton;
public class MyClass{
public static void main(String args[]) {
// Create a PDF Document
Document document = new Document();
// Create a PDF Page
Page page = new Page( PageSize.LETTER );
// Create an Radio Buttons
RadioButton radio = new RadioButton( "rdbtn", 50, 25, 100, 75 );
radio.setDefaultChecked( true );
radio.setToolTip("first");
RadioButton radio1 = new RadioButton( "rdbtn", 50, 140, 100, 75 );
radio1.setDefaultChecked( true );
radio1.setExportValue( "abc" );
radio1.setToolTip( "second" );
RadioButton radio2 = new RadioButton( "rdbtn", 50, 250, 100, 75 );
radio2.setDefaultChecked( true );
radio2.setExportValue( "xyz" );
radio2.setToolTip("third");
// Add the Radio Buttons to the page
page.getElements().add( radio );
page.getElements().add( radio1 );
page.getElements().add( radio2 );
// Add pages to the document
document.getPages().add( page );
// Save the PDF document
document.draw("[PhysicalPath]/MyDocument.pdf");
}
}