

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
public static interface MSBLayout.Constraints
Every box in an MSBLayout is associated with a Constraints object that controls the sizing and
placement behaviour of the box. The methods MSBLayout.add(Component, Constraints)
,
Container.add(Component, Object)
, hbox(Constraints)
and vbox(Constraints)
accept Constraints that will be used
for the new box. If you do not use one of these methods, MSBLayout
will use a
ConstraintsFactory
to provide an appropriate Constraints object.
Constraints is a readonly interface. The interface MutableConstraints
extends Constraints with the corresponding methods for setting constraints.
A simple implementation of this interface is available as the ConstraintsImpl
class.
MSBLayout.ConstraintsImpl
,
MSBLayout.MutableConstraints
Method Summary  

int 
bottom()
Returns the bottom margin which is either a nonnegative number of pixels or one of the Gap constants. 
String[] 
groups()
Returns the names of all Group s this box is member of. 
float 
halign()
Returns the horizontal alignment of this box, i.e. its horizontal placement within the containing parent box. 
int 
hfill()
Returns the box's willingness to grow horizontally to fill excess space. 
float 
hscale()
A box that is part of a Group with tieWidth() uses the
group's tied minimum, preferred and maximum widths multiplied by this factor. 
int 
hshrink()
When several sibling boxes are shrunk smaller than their preferred widths because the container is too small, the hshrink() value determines the relative amount that is taken away from a box's width. 
int 
hweight()
When several sibling boxes are grown larger than their preferred widths to fill excess space in the containing box, the hweight() value determines the relative amounts of additional width the boxes get. 
int 
left()
Returns the left margin which is either a nonnegative number of pixels or one of the Gap constants. 
Insets 
margin()
Returns the amount of blank space added around the box's content where each of the top, left, bottom and right values is either a nonnegative number of pixels or one of the Gap constants. 
Dimension 
padding()
Returns an amount of space that is added to the box's minimum, preferred and maximum sizes when doing size computations. 
int 
right()
Returns the right margin which is either a nonnegative number of pixels or one of the Gap constants. 
int 
top()
Returns the top margin which is either a nonnegative number of pixels or one of the Gap constants. 
float 
valign()
Returns the vertical alignment of this box, i.e. its vertical placement within the containing parent box. 
int 
vfill()
Returns the box's willingness to grow vertically to fill excess space. 
float 
vscale()
A box that is part of a Group with Group.tieHeight()
uses the group's tied minimum, preferred and maximum heights multiplied by this factor. 
int 
vshrink()
When several sibling boxes are shrunk smaller than their preferred heights because the container is too small, the vshrink() value determines the relative amount that is taken away from a box's height. 
int 
vweight()
When several sibling boxes are grown larger than their preferred heights to fill excess space in the containing box, the vweight() value determines the relative amounts of additional height the boxes get. 
Method Detail 

String[] groups()
Group
s this box is member of. If the box is member of
no groups, a 0length array is returned.
MSBLayout.MutableConstraints.groups(String)
,
MSBLayout.MutableConstraints.groups(String[])
int hfill()
MutableConstraints.hfill(int)
for details on the
possible values.
MSBLayout.MutableConstraints.hfill(int)
,
vfill()
int vfill()
MutableConstraints.vfill(int)
for details on the
possible values.
MSBLayout.MutableConstraints.vfill(int)
,
vfill()
float hscale()
Group
with tieWidth()
uses the
group's tied minimum, preferred and maximum widths multiplied by this factor.
float vscale()
Group
with Group.tieHeight()
uses the group's tied minimum, preferred and maximum heights multiplied by this factor.
Insets margin()
Gap
constants. The returned Insets
object aggregates the values returned by
left()
, right()
, bottom()
and top()
.
MSBLayout.Gap
,
MSBLayout.MutableConstraints.margin(Insets)
,
MSBLayout.MutableConstraints.margin(int, int, int, int)
,
padding()
,
left()
,
top()
,
bottom()
,
right()
int left()
Gap
constants.
margin()
int right()
Gap
constants.
margin()
int top()
Gap
constants.
margin()
int bottom()
Gap
constants.
margin()
Dimension padding()
Dimension
are
always nonnegative.
Note that padding is very different from a margin. A margin is an empty space around a box.
Padding on the other hand grows the box's content. Unlike margins, padding is used rather
infrequently.
MSBLayout.MutableConstraints.padding(Dimension)
,
MSBLayout.MutableConstraints.padding(int, int)
,
margin()
int hweight()
hshrink()
has the same role when shrinking boxes below their preferred
widths. The returned value is always >0 and <=MAX_WEIGHT_SHRINK
. A weight of 0 is not possible. A box that is not supposed to grow is
defined by hfill()
==0.
MSBLayout.MutableConstraints.hweight(int)
,
hfill()
,
hshrink()
,
vweight()
int vweight()
vshrink()
has the same role when shrinking boxes below their preferred
heights. The returned value is always >0 and <=MAX_WEIGHT_SHRINK
. A weight of 0 is not possible. A box that is not supposed to grow is
defined by vfill()
==0.
MSBLayout.MutableConstraints.vweight(int)
,
vfill()
,
vshrink()
,
hweight()
int hshrink()
hweight()
has the same role when growing boxes larger than their preferred widths.
The returned value is always >0 and <=MAX_WEIGHT_SHRINK
.
A weight of 0 is not allowed because it must always be possible to fit the layout inside the
container, which may require shrinking all boxes even below their minimum widths.
MSBLayout.MutableConstraints.hshrink(int)
,
hweight()
,
vweight()
int vshrink()
vweight()
has the same role when growing boxes larger than their preferred heights.
The returned value is always >0 and <=MAX_WEIGHT_SHRINK
.
A weight of 0 is not allowed because it must always be possible to fit the layout inside the
container, which may require shrinking all boxes even below their minimum heights.
MSBLayout.MutableConstraints.vshrink(int)
,
vweight()
,
hweight()
float halign()
MutableConstraints.halign(float)
.
MSBLayout.MutableConstraints.halign(float)
,
valign()
float valign()
MutableConstraints.halign(float)
.
MSBLayout.MutableConstraints.valign(float)
,
halign()


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
Copyright © 2010 Matthias S. Benkmann. See LICENSE file for licensing details.
Hosted on