Class FormData


  • public final class FormData
    extends java.lang.Object
    Instances of this class are used to define the attachments of a control in a FormLayout.

    To set a FormData object into a control, you use the setLayoutData () method. To define attachments for the FormData, set the fields directly, like this:

        FormData data = new FormData();
        data.left = new FormAttachment(0,5);
        data.right = new FormAttachment(100,-5);
        button.setLayoutData(formData);
     

    FormData contains the FormAttachments for each edge of the control that the FormLayout uses to determine the size and position of the control. FormData objects also allow you to set the width and height of controls within a FormLayout.

    Since:
    1.0
    See Also:
    FormLayout, FormAttachment, Sample code and further information
    • Field Summary

      Fields 
      Modifier and Type Field Description
      FormAttachment bottom
      bottom specifies the attachment of the bottom of the control.
      int height
      height specifies the preferred height in pixels.
      FormAttachment left
      left specifies the attachment of the left side of the control.
      FormAttachment right
      right specifies the attachment of the right side of the control.
      FormAttachment top
      top specifies the attachment of the top of the control.
      int width
      width specifies the preferred width in pixels.
    • Constructor Summary

      Constructors 
      Constructor Description
      FormData()
      Constructs a new instance of FormData using default values.
      FormData​(int width, int height)
      Constructs a new instance of FormData according to the parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String toString()
      Returns a string containing a concise, human-readable description of the receiver.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • width

        public int width
        width specifies the preferred width in pixels. This value is the wHint passed into Control.computeSize(int, int, boolean) to determine the preferred size of the control. The default value is SWT.DEFAULT.
        See Also:
        Control.computeSize(int, int, boolean)
      • height

        public int height
        height specifies the preferred height in pixels. This value is the hHint passed into Control.computeSize(int, int, boolean) to determine the preferred size of the control. The default value is SWT.DEFAULT.
        See Also:
        Control.computeSize(int, int, boolean)
      • left

        public FormAttachment left
        left specifies the attachment of the left side of the control.
      • right

        public FormAttachment right
        right specifies the attachment of the right side of the control.
      • top

        public FormAttachment top
        top specifies the attachment of the top of the control.
      • bottom

        public FormAttachment bottom
        bottom specifies the attachment of the bottom of the control.
    • Constructor Detail

      • FormData

        public FormData()
        Constructs a new instance of FormData using default values.
      • FormData

        public FormData​(int width,
                        int height)
        Constructs a new instance of FormData according to the parameters. A value of SWT.DEFAULT indicates that no minimum width or no minimum height is specified.
        Parameters:
        width - a minimum width for the control
        height - a minimum height for the control
    • Method Detail

      • toString

        public java.lang.String toString()
        Returns a string containing a concise, human-readable description of the receiver.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the FormData object