Example: The following example shows how to create an List Box and Add it to the page.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.forms.*;
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 List Box
ListBox listBox = new ListBox( "list", 5, 2, 100, 150 );
listBox.addItem( "One" );
listBox.addItem( "Two" );
listBox.addItem( "Three" );
listBox.addItem( "Four" );
listBox.addItem( "Five" );
listBox.setBackgroundColor( RgbColor.getAliceBlue() );
listBox.setBorderColor( RgbColor.getDarkMagenta() );
listBox.setBorderStyle( BorderStyle.DASHED );
listBox.setDefaultChoice("One");
listBox.setMultiselect( true );
listBox.setToolTip( "Select" );
// Add the List Box to the page
page.getElements().add( listBox );
// Add pages to the document
document.getPages().add( page );
// Save the PDF document
document.draw("[PhysicalPath]/MyDocument.pdf");
}
}