This will work:
PdfFormField top = PdfFormField.createCheckBox(writer);
top.setFieldName("check");
RadioCheckField bt1 = new RadioCheckField(writer, new Rectangle(100,
600, 200, 650), null, "v1");
bt1.setCheckType(RadioCheckField.TYPE_CROSS);
bt1.setChecked(false);
PdfFormField f1 = bt1.getCheckField();
f1.remove(PdfName.T);
top.addKid(f1);
RadioCheckField bt2 = new RadioCheckField(writer, new Rectangle(100,
500, 200, 550), null, "v1");
bt2.setCheckType(RadioCheckField.TYPE_CHECK);
bt2.setChecked(false);
PdfFormField f2 = bt2.getCheckField();
f2.remove(PdfName.T);
top.addKid(f2);
writer.addAnnotation(top);
f1.remove(PdfName.T) and f2.remove(PdfName.T) won't be needed in the
next release. Note that the on value name for both fields must be the
same.
> -----Original Message-----
> From: wang yun [mailto:yunwangwatlow@(protected)]
> Sent: Monday, June 27, 2005 12:47 PM
> To: Paulo Soares
> Subject: RE: [iText-questions] Two Check Buttom Fields with
> the same name
>
> Paulo,
>
> Thanks for yoru help.
>
> I try to folow Textfield style, but, i can only create
> one check box. The second does't show.
>
> Please do me a favor to look my following code:
>
> Thanks.
>
> yun wang
>
>
> Document document = new Document(PageSize.A4, 50, 50,
> 50, 50);
> PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream("output.pdf"));
> document.open();
>
> PdfFormField top =
> PdfFormField.createCheckBox(writer);
> top.setFieldName("check");
>
> RadioCheckField bt1 = new RadioCheckField(writer, new
> Rectangle(100, 600, 200, 650), null, "v1");
> bt1.setCheckType(RadioCheckField.TYPE_CROSS);
> bt1.setChecked(false);
> PdfFormField f1 = bt1.getCheckField();
> top.addKid(f1);
>
>
> RadioCheckField bt2 = new RadioCheckField(writer, new
> Rectangle(100, 500, 200, 550), null, "v2");
> bt2.setCheckType(RadioCheckField.TYPE_CHECK);
> bt2.setChecked(true);
> PdfFormField f2 = bt2.getCheckField();
> top.addKid(f2);
>
> writer.addAnnotation(top);
>
> document.close();
>
>
>
>
> --- Paulo Soares <psoares@(protected):
>
> > Only radio groups are supposed to work together. For
> > check boxes use the
> > same technique you used with text fields.
>
>
>
>
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions