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.
FormLayout, FormAttachment, Sample code and further information
| Modifier and Type | Field and Description |
|---|---|
| public FormAttachment | bottom
bottom specifies the attachment of the bottom of the control. |
| pack-priv FormAttachment | |
| pack-priv int | |
| pack-priv FormAttachment | |
| pack-priv FormAttachment | |
| pack-priv FormAttachment | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| public int | height
height specifies the preferred height in points. |
| pack-priv boolean | |
| public FormAttachment | left
left specifies the attachment of the left side of the control. |
| pack-priv boolean | |
| public FormAttachment | right
right specifies the attachment of the right side of the control. |
| public FormAttachment | top
top specifies the attachment of the top of the control. |
| public int | width
width specifies the preferred width in points. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | FormData(int
a minimum width for the control width, int a minimum height for the control height)Constructs a new instance of FormData according to the parameters. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv void | |
| pack-priv FormAttachment | |
| pack-priv int | |
| pack-priv FormAttachment | |
| pack-priv String | |
| pack-priv FormAttachment | |
| pack-priv FormAttachment | |
| pack-priv int | |
| public String | Returns: a string representation of the FormData objectOverrides java. |
| bottom | back to summary |
|---|---|
| public FormAttachment bottom bottom specifies the attachment of the bottom of the control. | |
| cacheBottom | back to summary |
|---|---|
| pack-priv FormAttachment cacheBottom | |
| cacheHeight | back to summary |
|---|---|
| pack-priv int cacheHeight | |
| cacheLeft | back to summary |
|---|---|
| pack-priv FormAttachment cacheLeft | |
| cacheRight | back to summary |
|---|---|
| pack-priv FormAttachment cacheRight | |
| cacheTop | back to summary |
|---|---|
| pack-priv FormAttachment cacheTop | |
| cacheWidth | back to summary |
|---|---|
| pack-priv int cacheWidth | |
| currentHeight | back to summary |
|---|---|
| pack-priv int currentHeight | |
| currentHhint | back to summary |
|---|---|
| pack-priv int currentHhint | |
| currentWhint | back to summary |
|---|---|
| pack-priv int currentWhint | |
| currentWidth | back to summary |
|---|---|
| pack-priv int currentWidth | |
| defaultHeight | back to summary |
|---|---|
| pack-priv int defaultHeight | |
| defaultHhint | back to summary |
|---|---|
| pack-priv int defaultHhint | |
| defaultWhint | back to summary |
|---|---|
| pack-priv int defaultWhint | |
| defaultWidth | back to summary |
|---|---|
| pack-priv int defaultWidth | |
| height | back to summary |
|---|---|
| public int height height specifies the preferred height in points. 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. | |
| isVisited | back to summary |
|---|---|
| pack-priv boolean isVisited | |
| left | back to summary |
|---|---|
| public FormAttachment left left specifies the attachment of the left side of the control. | |
| needed | back to summary |
|---|---|
| pack-priv boolean needed | |
| right | back to summary |
|---|---|
| public FormAttachment right right specifies the attachment of the right side of the control. | |
| top | back to summary |
|---|---|
| public FormAttachment top top specifies the attachment of the top of the control. | |
| width | back to summary |
|---|---|
| public int width width specifies the preferred width in points. 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. | |
| FormData | back to summary |
|---|---|
| public FormData() Constructs a new instance of FormData using default values. | |
| FormData | back to summary |
|---|---|
| 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.
| |
| computeSize | back to summary |
|---|---|
| pack-priv void computeSize(Control control, int wHint, int hHint, boolean flushCache) | |
| flushCache | back to summary |
|---|---|
| pack-priv void flushCache() | |
| getBottomAttachment | back to summary |
|---|---|
| pack-priv FormAttachment getBottomAttachment(Control control, int spacing, boolean flushCache) | |
| getHeight | back to summary |
|---|---|
| pack-priv int getHeight(Control control, boolean flushCache) | |
| getLeftAttachment | back to summary |
|---|---|
| pack-priv FormAttachment getLeftAttachment(Control control, int spacing, boolean flushCache) | |
| getName | back to summary |
|---|---|
| pack-priv String getName() | |
| getRightAttachment | back to summary |
|---|---|
| pack-priv FormAttachment getRightAttachment(Control control, int spacing, boolean flushCache) | |
| getTopAttachment | back to summary |
|---|---|
| pack-priv FormAttachment getTopAttachment(Control control, int spacing, boolean flushCache) | |
| getWidth | back to summary |
|---|---|
| pack-priv int getWidth(Control control, boolean flushCache) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string containing a concise, human-readable description of the receiver. | |