|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.FlowLayout
se.datadosen.component.RiverLayout
public class RiverLayout
RiverLayout makes it very simple to construct user interfaces as components are laid out similar to how text is added to a word processor (Components flow like a "river". RiverLayout is however much more powerful than FlowLayout: Components added with the add() method generally gets laid out horizontally, but one may add a string before the component being added to specify "constraints" like this: add("br hfill", new JTextField("Your name here"); The code above forces a "line break" and extends the added component horizontally. Without the "hfill" constraint, the component would take on its preferred size.
List of constraints:
Field Summary | |
---|---|
static java.lang.String |
CENTER
|
static java.lang.String |
HFILL
|
static java.lang.String |
LEFT
|
static java.lang.String |
LINE_BREAK
|
static java.lang.String |
PARAGRAPH_BREAK
|
static java.lang.String |
RIGHT
|
static java.lang.String |
TAB_STOP
|
static java.lang.String |
VCENTER
|
static java.lang.String |
VFILL
|
static java.lang.String |
VTOP
|
Fields inherited from class java.awt.FlowLayout |
---|
LEADING, TRAILING |
Constructor Summary | |
---|---|
RiverLayout()
|
|
RiverLayout(int hgap,
int vgap)
|
Method Summary | |
---|---|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
|
protected void |
adjustAlignment(java.awt.Component m)
|
protected se.datadosen.component.Ruler |
calcTabs(java.awt.Container target)
Figure out tab stop x-positions |
java.awt.Insets |
getExtraInsets()
|
int |
getHgap()
Gets the horizontal gap between components. |
protected java.awt.Insets |
getInsets(java.awt.Container target)
|
int |
getVgap()
Gets the vertical gap between components. |
void |
layoutContainer(java.awt.Container target)
Lays out the container. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container target)
Returns the minimum dimensions needed to layout the visible components contained in the specified target container. |
protected void |
moveComponents(java.awt.Container target,
int x,
int y,
int width,
int height,
int rowStart,
int rowEnd,
boolean ltr,
se.datadosen.component.Ruler ruler)
Centers the elements in the specified row, if there is any slack. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container target)
Returns the preferred dimensions for this layout given the visible components in the specified target container. |
protected void |
relMove(java.awt.Container target,
int dx,
int dy,
int rowStart,
int rowEnd)
|
void |
removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout. |
void |
setExtraInsets(java.awt.Insets newExtraInsets)
|
void |
setHgap(int hgap)
Sets the horizontal gap between components. |
void |
setVgap(int vgap)
Sets the vertical gap between components. |
Methods inherited from class java.awt.FlowLayout |
---|
getAlignment, getAlignOnBaseline, setAlignment, setAlignOnBaseline, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LINE_BREAK
public static final java.lang.String PARAGRAPH_BREAK
public static final java.lang.String TAB_STOP
public static final java.lang.String HFILL
public static final java.lang.String VFILL
public static final java.lang.String LEFT
public static final java.lang.String RIGHT
public static final java.lang.String CENTER
public static final java.lang.String VTOP
public static final java.lang.String VCENTER
Constructor Detail |
---|
public RiverLayout()
public RiverLayout(int hgap, int vgap)
Method Detail |
---|
public int getHgap()
getHgap
in class java.awt.FlowLayout
public void setHgap(int hgap)
setHgap
in class java.awt.FlowLayout
public int getVgap()
getVgap
in class java.awt.FlowLayout
public java.awt.Insets getExtraInsets()
public void setExtraInsets(java.awt.Insets newExtraInsets)
protected java.awt.Insets getInsets(java.awt.Container target)
public void setVgap(int vgap)
setVgap
in class java.awt.FlowLayout
public void addLayoutComponent(java.lang.String name, java.awt.Component comp)
addLayoutComponent
in interface java.awt.LayoutManager
addLayoutComponent
in class java.awt.FlowLayout
name
- the name of the componentcomp
- the component to be addedpublic void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent
in interface java.awt.LayoutManager
removeLayoutComponent
in class java.awt.FlowLayout
comp
- the component to removeContainer.removeAll()
protected se.datadosen.component.Ruler calcTabs(java.awt.Container target)
public java.awt.Dimension preferredLayoutSize(java.awt.Container target)
preferredLayoutSize
in interface java.awt.LayoutManager
preferredLayoutSize
in class java.awt.FlowLayout
target
- the component which needs to be laid out
Container
,
minimumLayoutSize(java.awt.Container)
,
Container.getPreferredSize()
public java.awt.Dimension minimumLayoutSize(java.awt.Container target)
minimumLayoutSize
in interface java.awt.LayoutManager
minimumLayoutSize
in class java.awt.FlowLayout
target
- the component which needs to be laid out
preferredLayoutSize(java.awt.Container)
,
Container
,
Container.doLayout()
protected void moveComponents(java.awt.Container target, int x, int y, int width, int height, int rowStart, int rowEnd, boolean ltr, se.datadosen.component.Ruler ruler)
target
- the component which needs to be movedx
- the x coordinatey
- the y coordinatewidth
- the width dimensionsheight
- the height dimensionsrowStart
- the beginning of the rowrowEnd
- the the ending of the rowprotected void relMove(java.awt.Container target, int dx, int dy, int rowStart, int rowEnd)
protected void adjustAlignment(java.awt.Component m)
public void layoutContainer(java.awt.Container target)
FlowLayout
object.
layoutContainer
in interface java.awt.LayoutManager
layoutContainer
in class java.awt.FlowLayout
target
- the specified component being laid outContainer
,
Container.doLayout()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |