public class AlignLayout extends AbstractLayoutManager implements javax.swing.SwingConstants
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.awt.Component,java.lang.String> |
constraints
Constraints cache for added components.
|
protected boolean |
hfill
Whether components should fill all available horizontal space or not.
|
protected int |
hgap
Horizontal gap between components.
|
static java.util.List<java.lang.Integer> |
horizontals
Horizontal alignment constraints.
|
static java.lang.String |
SEPARATOR
Layout constraints separator.
|
static java.util.List<java.lang.Integer> |
verticals
Vertical alignment constraints.
|
protected boolean |
vfill
Whether components should fill all available vertical space or not.
|
protected int |
vgap
Vertical gap between components.
|
| Constructor and Description |
|---|
AlignLayout()
Constructs new align layout.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addComponent(java.awt.Component component,
java.lang.Object constraints)
Called when component added into container with this layout.
|
protected int |
getHalign(java.lang.String name)
Returns horizontal alignment for the specified constraint.
|
int |
getHgap()
Returns horizontal gap between components.
|
protected java.awt.Dimension |
getSideSize(java.awt.Container parent,
int halign,
int valign)
Returns size for the side specified by horizontal and vertical alignments.
|
protected int |
getValign(java.lang.String name)
Returns vertical alignment for the specified constraint.
|
int |
getVgap()
Returns vertical gap between components.
|
protected void |
illegalArgument()
Throws illegal argument (constraint) exception.
|
boolean |
isHfill()
Returns whether components should fill all available horizontal space or not.
|
boolean |
isVfill()
Returns whether components should fill all available vertical space or not.
|
void |
layoutContainer(java.awt.Container parent) |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container parent) |
void |
removeComponent(java.awt.Component component)
Called when component removed from container with this layout.
|
void |
setHfill(boolean hfill)
Sets whether components should fill all available horizontal space or not.
|
void |
setHgap(int hgap)
Sets horizontal gap between components.
|
void |
setVfill(boolean vfill)
Sets whether components should fill all available vertical space or not.
|
void |
setVgap(int vgap)
Sets vertical gap between components.
|
addLayoutComponent, addLayoutComponent, getLayoutAlignmentX, getLayoutAlignmentY, invalidateLayout, maximumLayoutSize, minimumLayoutSize, removeLayoutComponentpublic static final java.lang.String SEPARATOR
public static final java.util.List<java.lang.Integer> horizontals
public static final java.util.List<java.lang.Integer> verticals
protected final java.util.Map<java.awt.Component,java.lang.String> constraints
protected int hgap
protected int vgap
protected boolean hfill
protected boolean vfill
public int getHgap()
public void setHgap(int hgap)
hgap - new horizontal gap between componentspublic int getVgap()
public void setVgap(int vgap)
vgap - new vertical gap between componentspublic boolean isHfill()
public void setHfill(boolean hfill)
hfill - whether components should fill all available horizontal space or notpublic boolean isVfill()
public void setVfill(boolean vfill)
vfill - whether components should fill all available vertical space or notpublic void addComponent(java.awt.Component component,
java.lang.Object constraints)
AbstractLayoutManageraddComponent in class AbstractLayoutManagercomponent - added componentconstraints - component constraintsprotected void illegalArgument()
protected int getHalign(java.lang.String name)
name - constraintprotected int getValign(java.lang.String name)
name - constraintpublic void removeComponent(java.awt.Component component)
AbstractLayoutManagerremoveComponent in class AbstractLayoutManagercomponent - removed componentpublic java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
preferredLayoutSize in interface java.awt.LayoutManagerprotected java.awt.Dimension getSideSize(java.awt.Container parent,
int halign,
int valign)
parent - containerhalign - horizontal alignmentvalign - vertical alignmentpublic void layoutContainer(java.awt.Container parent)
layoutContainer in interface java.awt.LayoutManager