|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.zaval.lw.LwFlowLayout
This class implements layout manager interface. The impementation layouts child components according three parameters : direction (can be LwToolkit.HORIZONTAL or LwToolkit.VERTICAL), vertical alignment (Alignment.TOP, Alignment.BOTTOM, Alignment.CENTER) and horizontal alignment (Alignment.LEFT, Alignment.RIGHT, Alignment.CENTER).
The first parameter defines direction, if the direction is LwToolkit.VERTICAL than every following component will be added under the previous, otherwise every following component will be added to the right of the previous.
The vertical and horizontal alignments define how the child components will be laidout relatively the parent container. The table below shows the samples of the layout manager usage:
Direction | Horizontal alignment | Vertical alignment | Sample App |
LwToolkit.HORIZONTAL | Alignment.LEFT | Alignment.TOP | |
LwToolkit.VERTICAL | Alignment.LEFT | Alignment.TOP | |
LwToolkit.VERTICAL | Alignment.RIGHT | Alignment.TOP | |
LwToolkit.HORIZONTAL | Alignment.CENTER | Alignment.CENTER | |
LwToolkit.HORIZONTAL | Alignment.CENTER | Alignment.BOTTOM |
Constructor Summary | |
LwFlowLayout()
Constructs a new flow layout manager with default parameters. |
|
LwFlowLayout(int ax,
int ay)
Constructs a new flow layout manager with the specified horizontal and vertical alignments. |
|
LwFlowLayout(int ax,
int ay,
int dir)
Constructs a new flow layout manager with the specified horizontal, vertical alignments and the direction. |
|
LwFlowLayout(int ax,
int ay,
int dir,
int vg,
int hg)
Constructs a new flow layout manager with the specified horizontal, vertical alignments, the direction and the given gaps. |
Method Summary | |
java.awt.Dimension |
calcPreferredSize(LayoutContainer target)
Calculates the preferred size dimensions for the layout container. |
void |
componentAdded(java.lang.Object id,
Layoutable lw,
int index)
Invoked when the specified layoutable component is added to the layout container (that uses the layout manager). |
void |
componentRemoved(Layoutable lw,
int index)
Invoked when the specified layoutable component is removed from the layout container, that uses the layout manager. |
int |
getHGap()
Gets the horizontal gap. |
int |
getVGap()
Gets the vertical gap. |
void |
layout(LayoutContainer c)
Lays out the child layoutable components inside the layout container. |
void |
setGaps(int vg,
int hg)
Sets the vertical and horizontal gaps. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LwFlowLayout()
public LwFlowLayout(int ax, int ay)
ax
- the specified horizontal alignment.ay
- the specified vertical alignment.public LwFlowLayout(int ax, int ay, int dir)
ax
- the specified horizontal alignment.ay
- the specified vertical alignment.dir
- the specified direction.public LwFlowLayout(int ax, int ay, int dir, int vg, int hg)
ax
- the specified horizontal alignment.ay
- the specified vertical alignment.dir
- the specified direction.vg
- the specified vertical gap.hg
- the specified horizontal gap.Method Detail |
public java.awt.Dimension calcPreferredSize(LayoutContainer target)
calcPreferredSize
in interface LwLayout
target
- the layout container.public void layout(LayoutContainer c)
layout
in interface LwLayout
c
- the layout container that needs to be laid out.public int getVGap()
public int getHGap()
public void setGaps(int vg, int hg)
vg
- the specified vertical gap.hg
- the specified horizontal gap.public void componentAdded(java.lang.Object id, Layoutable lw, int index)
componentAdded
in interface LwLayout
id
- the layoutable component constraints.lw
- the layoutable component.index
- the child index.public void componentRemoved(Layoutable lw, int index)
componentRemoved
in interface LwLayout
lw
- the layoutable component to be removedindex
- the child index.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |