Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.faceless.pdf2
Class FormButton

    java.lang.Object
      org.faceless.pdf2.FormElement
          org.faceless.pdf2.FormButton

All Implemented Interfaces:
  Cloneable

    public final class FormButton

extends FormElement

A type of `FormElement` representing a "Push Button", of the kind used to trigger an action like submitting or resetting a form.

A push buttons has no value - it's `getValue()` method will always return `null`. However, each `WidgetAnnotation` returned by the `FormElement.getAnnotations()` method may have a different value specified - although these values are not submitted with the form. Buttons may also have images associated with them, which can be set via the `WidgetAnnotation.setButtonImage(org.faceless.pdf2.PDFImage)` method.

Here's an example showing how to add a pushbutton which submits the form.

       PDFAction act = PDFAction.formSubmit("/servlet/Submit", PDFAction.METHOD_HTTP_POST));
       Form form = pdf.getForm();
       FormButton button = new FormButton();
       WidgetAnnotation annot = button.addAnnotation(pdf.getLastPage(), 100,100,200,120);
       annot.setValue("Submit");
       annot.setAction(Event.MOUSEUP, act);
       form.addElement("SubmitButton", button);

Since:
  1.1.23

Constructor Summary
`FormButton()` Create a new FormButton element.
`FormButton(PDFPage page, float x1, float y1, float x2, float y2)` Create a new FormButton element, and add a single annotation at the specified position.

Method Summary
`WidgetAnnotation` | `addAnnotation(PDFPage page, float x1, float y1, float x2, float y2)` Add an annotation for this Form element at the specified position on the specified page.
`String` | `getValue()` `FormButton` elements don't have a value, so this method always returns `null` - try calling the `WidgetAnnotation.getValue()` method on the `WidgetAnnotation` class to get back the text label of a button.
`void` | `rebuild()` Cause the annotations to be rebuilt.
`String` | `toString()`

Methods inherited from class org.faceless.pdf2.FormElement
`addPropertyChangeListener, duplicate, flatten, getAction, getAnnotation, getAnnotations, getDescription, getForm, isReadOnly, isRequired, isSubmitted, removePropertyChangeListener, setAction, setDescription, setReadOnly, setRequired, setSubmitted`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### FormButton

    public FormButton()

  Create a new FormButton element. With this constructor at least one annotation must be added explicitly by calling the `addAnnotation` method

  Since:
    1.1.26

### FormButton

    public FormButton(PDFPage page,
                      float x1,
                      float y1,
                      float x2,
                      float y2)

  Create a new FormButton element, and add a single annotation at the specified position. Equivalent to

        FormButton button = new FormButton();
        button.addAnnotation(page,x1,y1,x2,y2);

  Parameters:
    `page` - the page to place the annotation on
    `x1` - the left-most X co-ordinate of the annotation
    `y1` - the top-most Y co-ordinate of the annotation
    `x2` - the right-most X co-ordinate of the annotation
    `y2` - the bottom-most Y co-ordinate of the annotation

Method Detail

### addAnnotation

    public WidgetAnnotation addAnnotation(PDFPage page,
                                          float x1,
                                          float y1,
                                          float x2,
                                          float y2)

  Add an annotation for this Form element at the specified position on the specified page.

  Parameters:
    `page` - the page to place the annotation on
    `x1` - the left-most X co-ordinate of the annotation
    `y1` - the top-most Y co-ordinate of the annotation
    `x2` - the right-most X co-ordinate of the annotation
    `y2` - the bottom-most Y co-ordinate of the annotation
  Since:
    2.0

### getValue

    public String getValue()

  `FormButton` elements don't have a value, so this method always returns `null` - try calling the `WidgetAnnotation.getValue()` method on the `WidgetAnnotation` class to get back the text label of a button.

  Specified by:
    `getValue` in class `FormElement`

### rebuild

    public void rebuild()

  Description copied from class: `FormElement`
  Cause the annotations to be rebuilt. Unless you're rendering the annotation using the viewer, it's not necessary to call this method.

  Overrides:
    `rebuild` in class `FormElement`

### toString

    public String toString()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Big Faceless Organization