{widget.setAppearance(appearance = new Appearance(document));}
FormXObject normalAppearanceState = new FormXObject(document);
{
Rectangle2D widgetBox = widget.getBox();
Dimension2D size = new Dimension(widgetBox.getWidth(),widgetBox.getHeight());
normalAppearanceState.setSize(size);
PrimitiveComposer composer = new PrimitiveComposer(normalAppearanceState);
composer.beginLocalState();
float lineWidth = 1;
composer.setLineWidth(lineWidth);
composer.setFillColor(getBackColor());
composer.setStrokeColor(getForeColor());
Rectangle2D frame = new Rectangle2D.Double(lineWidth/2,lineWidth/2,size.getWidth()-lineWidth,size.getHeight()-lineWidth);
composer.drawRectangle(frame,5);
composer.fillStroke();
composer.end();
String caption = (String)field.getValue();
if(caption != null)
{
BlockComposer blockComposer = new BlockComposer(composer);
blockComposer.begin(frame,AlignmentXEnum.Center,AlignmentYEnum.Middle);
composer.setFillColor(getForeColor());
composer.setFont(
new StandardType1Font(
document,
StandardType1Font.FamilyEnum.Helvetica,
true,
false
),
(float)(size.getHeight() * 0.5)
);
blockComposer.showText(caption);
blockComposer.end();
}