List of usage examples for com.lowagie.text.pdf RadioCheckField TYPE_CIRCLE
int TYPE_CIRCLE
To view the source code for com.lowagie.text.pdf RadioCheckField TYPE_CIRCLE.
Click Source Link
From source file:at.reppeitsolutions.formbuilder.components.pdf.itext.ITextRadio.java
License:Open Source License
@Override public void cellLayout(PdfPCell cell, Rectangle rectangle, PdfContentByte[] canvases) { PdfWriter writer = canvases[0].getPdfWriter(); PdfFormField radiogroup = PdfFormField.createRadioButton(writer, true); radiogroup.setFieldName(UUID.randomUUID().toString()); if (locked) { radiogroup.setFieldFlags(BaseField.READ_ONLY); }// www . j a v a2s .com RadioCheckField radio; for (int i = 0; i < values.length; i++) { try { Rectangle rect = getBoxRectangle(rectangle, i); radio = new RadioCheckField(writer, rect, null, UUID.randomUUID().toString()); radio.setBorderColor(GrayColor.GRAYBLACK); radio.setBackgroundColor(GrayColor.GRAYWHITE); radio.setCheckType(RadioCheckField.TYPE_CIRCLE); if (value != null && values[i].equals(value)) { radio.setChecked(true); } PdfFormField field = radio.getRadioField(); radiogroup.addKid(field); addBoxDescription(rectangle, i, values, canvases); } catch (IOException ex) { Logger.getLogger(ITextRadio.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(ITextRadio.class.getName()).log(Level.SEVERE, null, ex); } } writer.addAnnotation(radiogroup); }
From source file:questions.forms.RadioButtonsOnDifferentPages.java
private static void addRadioButton(PdfWriter writer, Rectangle rect, PdfFormField radio, String name, boolean on, int page) throws IOException, DocumentException { RadioCheckField check = new RadioCheckField(writer, rect, null, name); check.setCheckType(RadioCheckField.TYPE_CIRCLE); check.setChecked(on);//w w w . jav a 2 s .c o m PdfFormField field = check.getRadioField(); field.setPlaceInPage(page); radio.addKid(field); }