|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kirk.gui.layout.LineLayout
A custom LayoutManager
that lays out Component
s like a
vertical FlowLayout
that does not do multiple columns. Each
Component
is as wide as the Container
minus insets minus
gaps, or as wide as it prefers to be if it's maximum value is smaller.
Classes that extend this class make out how high each Component
is,
and where they are placed (vertically).
Therefore there are 3 abstract methods to override, which are also specified by
the LayoutManager
interface. Also provided are methods to retrieve
information about the width.
Note that Component
s are always on the left of the line. There is
also only one Component
per line. If you want to align your
Component
, or want more Component
s on a line, put a
Panel
on the line and go from there.
FlowLayout
Field Summary | |
private int |
horizontalgap
The horizontal gap. |
private int |
verticalgap
The vertical gap. |
Constructor Summary | |
LineLayout()
Constructs a new LineLayout . |
|
LineLayout(int verticalgap)
Constructs a new LineLayout with the given value for the vertical
gap, and the default value for the horizontal gap. |
|
LineLayout(int horizontalgap,
int verticalgap)
Constructs a new LineLayout with the given values for the gaps. |
Method Summary | |
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
Called by a Container that has this LayoutManager as
LayoutManager . |
int |
getHorizontalGap()
Returns the horizontal gap. |
int |
getMinimumWidth(java.awt.Container parent)
Returns the minimum width of the passed parent when it would be layed out by this class. |
int |
getPreferredWidth(java.awt.Container parent)
Returns the preferred width of the passed parent when it would be layed out by this class. |
int |
getVerticalGap()
Returns the vertical gap. |
int |
getWidth(java.awt.Container parent,
java.awt.Component component)
Returns the width the passed Component should have if it is layed
out by this class. |
abstract void |
layoutContainer(java.awt.Container parent)
Lays out the given Container . |
abstract java.awt.Dimension |
minimumLayoutSize(java.awt.Container parent)
Returns the minimum size of the Container if it get's layed out
by this LayoutManager . |
abstract java.awt.Dimension |
preferredLayoutSize(java.awt.Container parent)
Returns the preferred size of the Container if it get's layed out
by this LayoutManager . |
void |
removeLayoutComponent(java.awt.Component comp)
Called by a Container that has this LayoutManager as
LayoutManager . |
void |
setHorizontalGap(int horizontalgap)
Sets the horizontal gap. |
void |
setVerticalGap(int verticalgap)
Sets the vertical gap. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int horizontalgap
private int verticalgap
Constructor Detail |
public LineLayout(int horizontalgap, int verticalgap)
LineLayout
with the given values for the gaps.
public LineLayout(int verticalgap)
LineLayout
with the given value for the vertical
gap, and the default value for the horizontal gap.
public LineLayout()
LineLayout
. Use the default values for the gaps.
Method Detail |
public final int getHorizontalGap()
public final void setHorizontalGap(int horizontalgap)
public final int getVerticalGap()
public final void setVerticalGap(int verticalgap)
public final void addLayoutComponent(java.lang.String name, java.awt.Component comp)
Container
that has this LayoutManager
as
LayoutManager
. It should add the given Component
to
this LayoutManager
, however that is not neccesary. We use the
same approach as FlowLayout
.
addLayoutComponent
in interface java.awt.LayoutManager
LayoutManager.addLayoutComponent(java.lang.String,
java.awt.Component)
,
FlowLayout
public final void removeLayoutComponent(java.awt.Component comp)
Container
that has this LayoutManager
as
LayoutManager
. It should remove the given Component
to this LayoutManager
, however that is not neccesary. We use the
same approach as FlowLayout
.
removeLayoutComponent
in interface java.awt.LayoutManager
LayoutManager.removeLayoutComponent(java.awt.Component)
,
FlowLayout
public abstract java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Container
if it get's layed out
by this LayoutManager
.
preferredLayoutSize
in interface java.awt.LayoutManager
parent
- The Container
that the preferred size is wanted of.LayoutManager.preferredLayoutSize(java.awt.Container)
public abstract java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Container
if it get's layed out
by this LayoutManager
.
minimumLayoutSize
in interface java.awt.LayoutManager
parent
- The Container
that the minimum size is wanted of.LayoutManager.minimumLayoutSize(java.awt.Container)
public abstract void layoutContainer(java.awt.Container parent)
Container
.
layoutContainer
in interface java.awt.LayoutManager
parent
- The Container
to be layed out.LayoutManager.layoutContainer(java.awt.Container)
public final int getWidth(java.awt.Container parent, java.awt.Component component)
Component
should have if it is layed
out by this class.
Component
should have.public final int getPreferredWidth(java.awt.Container parent)
parent
.public final int getMinimumWidth(java.awt.Container parent)
parent
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |