class AddBorderToField
{
    static final String RESULT_FILENAME = "target/AddBorderToField.pdf";

    private AddBorderToField()
    {
    }
    
    public static void main(String[] args) throws IOException
    {<FILL_FUNCTION_BODY>}
}

        // Load the PDF document created by SimpleForm.java
        try (PDDocument document = Loader.loadPDF(new File(CreateSimpleForm.DEFAULT_FILENAME)))
        {
            PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();
            
            // Get the field and the widget associated to it.
            // Note: there might be multiple widgets
            PDField field = acroForm.getField("SampleField");
            PDAnnotationWidget widget = field.getWidgets().get(0);
            
            // Create the definition for a red border
            PDAppearanceCharacteristicsDictionary fieldAppearance =
                    new PDAppearanceCharacteristicsDictionary(new COSDictionary());
            PDColor red = new PDColor(new float[] { 1, 0, 0 }, PDDeviceRGB.INSTANCE);
            fieldAppearance.setBorderColour(red);

            // Set the information to be used by the widget which is responsible
            // for the visual style of the form field.
            widget.setAppearanceCharacteristics(fieldAppearance);
            
            document.save(RESULT_FILENAME);
        }
    
<no_super_class>