|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ layout overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.swt.layout
Class FormAttachment

java.lang.Objectorg.eclipse.swt.layout.FormAttachment
- public final class FormAttachment
- extends java.lang.Object
Instances of this class are used to define the edges of a control
within a FormLayout.
FormAttachments are set into the top, bottom, left,
and right fields of the FormData for a control.
For example:
FormData data = new FormData(); data.top = new FormAttachment(0,5); data.bottom = new FormAttachment(100,-5); data.left = new FormAttachment(0,5); data.right = new FormAttachment(100,-5); button.setLayoutData(data);
A FormAttachment defines where to attach the side of
a control by using the equation, y = ax + b. The "a" term represents
a fraction of the parent composite's width (from the left) or height
(from the top). It can be defined using a numerator and denominator,
or just a percentage value. If a percentage is used, the denominator
is set to 100. The "b" term in the equation represents an offset, in
pixels, from the attachment position. For example:
FormAttachment attach = new FormAttachment (20, -5);specifies that the side to which the
FormAttachment
object belongs will lie at 20% of the parent composite, minus 5 pixels.
Control sides can also be attached to another control. For example:
FormAttachment attach = new FormAttachment (button, 10);specifies that the side to which the
FormAttachment
object belongs will lie in the same position as the adjacent side of
the button control, plus 10 pixels. The control side can
also be attached to the opposite side of the specified control.
For example:
FormData data = new FormData (); data.left = new FormAttachment (button, 0, SWT.LEFT);specifies that the left side of the control will lie in the same position as the left side of the
button control. The control can also
be attached in a position that will center the control on the specified
control. For example:
data.left = new FormAttachment (button, 0, SWT.CENTER);specifies that the left side of the control will be positioned so that it is centered between the left and right sides of the
button control.
If the alignment is not specified, the default is to attach to the adjacent side.
- Since:
- 2.0
| Field Summary | |
int |
alignment
alignment specifies the alignment of the control side that is attached to a control. |
org.eclipse.swt.widgets.Control |
control
control specifies the control to which the control side is attached. |
int |
denominator
denominator specifies the denominator of the "a" term in the equation, y = ax + b, which defines the attachment. |
int |
numerator
numerator specifies the numerator of the "a" term in the equation, y = ax + b, which defines the attachment. |
int |
offset
offset specifies the offset, in pixels, of the control side from the attachment position. |
| Constructor Summary | |
(package private) |
FormAttachment()
|
|
FormAttachment(org.eclipse.swt.widgets.Control control)
Constructs a new instance of this class given a control. |
|
FormAttachment(org.eclipse.swt.widgets.Control control,
int offset)
Constructs a new instance of this class given a control and an offset. |
|
FormAttachment(org.eclipse.swt.widgets.Control control,
int offset,
int alignment)
Constructs a new instance of this class given a control, an offset and an alignment. |
|
FormAttachment(int numerator)
Constructs a new instance of this class given a numerator Since no denominator or offset is specified, the default is to treat the numerator as a percentage of the form, with a denominator of 100. |
|
FormAttachment(int numerator,
int offset)
Constructs a new instance of this class given a numerator and an offset. |
|
FormAttachment(int numerator,
int denominator,
int offset)
Constructs a new instance of this class given a numerator and denominator and an offset. |
| Method Summary | |
(package private) FormAttachment |
divide(int value)
|
(package private) int |
gcd(int m,
int n)
|
(package private) FormAttachment |
minus(FormAttachment attachment)
|
(package private) FormAttachment |
minus(int value)
|
(package private) FormAttachment |
plus(FormAttachment attachment)
|
(package private) FormAttachment |
plus(int value)
|
(package private) int |
solveX(int value)
|
(package private) int |
solveY(int value)
|
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
numerator
public int numerator
- numerator specifies the numerator of the "a" term in the
equation, y = ax + b, which defines the attachment.
denominator
public int denominator
- denominator specifies the denominator of the "a" term in the
equation, y = ax + b, which defines the attachment.
The default value is 100.
offset
public int offset
- offset specifies the offset, in pixels, of the control side
from the attachment position.
If the offset is positive, then the control side is offset
to the right of or below the attachment position. If it is
negative, then the control side is offset to the left of or
above the attachment position.
This is equivalent to the "b" term in the equation y = ax + b.
The default value is 0.
control
public org.eclipse.swt.widgets.Control control
- control specifies the control to which the control side is
attached.
alignment
public int alignment
- alignment specifies the alignment of the control side that is
attached to a control.
For top and bottom attachments, TOP, BOTTOM and CENTER are used. For left
and right attachments, LEFT, RIGHT and CENTER are used. If any other case
occurs, the default will be used instead.
Possible values are:
TOP: Attach the side to the top side of the specified control.
BOTTOM : Attach the side to the bottom side of the specified control.
LEFT: Attach the side to the left side of the specified control.
RIGHT: Attach the side to the right side of the specified control.
CENTER: Attach the side at a position which will center the control on
the specified control.
DEFAULT: Attach the side to the adjacent side of the specified control.
| Constructor Detail |
FormAttachment
FormAttachment()
FormAttachment
public FormAttachment(int numerator)
- Constructs a new instance of this class given a numerator
Since no denominator or offset is specified, the default
is to treat the numerator as a percentage of the form, with a
denominator of 100. The offset is zero.
- Since:
- 3.0
FormAttachment
public FormAttachment(int numerator,
int offset)
- Constructs a new instance of this class given a numerator
and an offset. Since no denominator is specified, the default
is to treat the numerator as a percentage of the form, with a
denominator of 100.
FormAttachment
public FormAttachment(int numerator,
int denominator,
int offset)
- Constructs a new instance of this class given a numerator
and denominator and an offset. The position of the side is
given by the fraction of the form defined by the numerator
and denominator.
FormAttachment
public FormAttachment(org.eclipse.swt.widgets.Control control)
- Constructs a new instance of this class given a control.
Since no alignment is specified, the default alignment is
to attach the side to the adjacent side of the specified
control. Since no offset is specified, an offset of 0 is
used.
FormAttachment
public FormAttachment(org.eclipse.swt.widgets.Control control, int offset)
- Constructs a new instance of this class given a control
and an offset. Since no alignment is specified, the default
alignment is to attach the side to the adjacent side of the
specified control.
FormAttachment
public FormAttachment(org.eclipse.swt.widgets.Control control, int offset, int alignment)
- Constructs a new instance of this class given a control,
an offset and an alignment.
| Method Detail |
divide
FormAttachment divide(int value)
gcd
int gcd(int m,
int n)
minus
FormAttachment minus(FormAttachment attachment)
minus
FormAttachment minus(int value)
plus
FormAttachment plus(FormAttachment attachment)
plus
FormAttachment plus(int value)
solveX
int solveX(int value)
solveY
int solveY(int value)
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ layout overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.eclipse.swt.layout.FormAttachment