public class MeltingLayout
extends java.lang.Object
implements java.awt.LayoutManager2, java.io.Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
MeltingLayout.ComponentGroupType
The two possible component groups: Label group and Input group.
|
static class |
MeltingLayout.Size
Different types of sizes that we might want to find: maximum size,
preferred size and minimum size.
|
| Modifier and Type | Field and Description |
|---|---|
static MeltingLayout.ComponentGroupType |
INPUT_GROUP
Component group type: input group.
|
static MeltingLayout.ComponentGroupType |
LABEL_GROUP
Component group type: label group.
|
| Constructor and Description |
|---|
MeltingLayout(java.awt.Container parent)
Constructs a new MELTING layout with no gaps between components.
|
MeltingLayout(java.awt.Container parent,
int hgap,
int vgap)
Constructs a MELTING layout with the specified gaps between components.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLayoutComponent(java.awt.Component component,
java.lang.Object constraints)
Adds a component to the layout, specifying that it belongs either to the
label group or to the input group, according to the constraint given.
|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component component)
Deprecated.
Only here because the interface demands it. Replaced by
addLayoutComponent(Component, Object). |
void |
checkContainer(java.awt.Container target)
Checks that a supplied container is the parent container for this layout.
|
float |
getLayoutAlignmentX(java.awt.Container parent)
Returns the alignment along the x axis.
|
float |
getLayoutAlignmentY(java.awt.Container parent)
Returns the alignment along the y axis.
|
void |
invalidateLayout(java.awt.Container parent)
Invalidates the layout, indicating that any cached information should be
discarded.
|
void |
layoutContainer(java.awt.Container target)
Lays out the container argument using this MELTING layout.
|
java.awt.Dimension |
maximumLayoutSize(java.awt.Container parent)
Returns the maximum size for the specified container.
|
java.awt.Dimension |
minimumLayoutSize(java.awt.Container parent)
Returns the minimum size for the specified container.
|
java.awt.Dimension |
preferredLayoutSize(java.awt.Container parent)
Returns the preferred size for the specified container.
|
void |
removeLayoutComponent(java.awt.Component component)
Removes the specified component from this MELTING layout.
|
public static final MeltingLayout.ComponentGroupType LABEL_GROUP
public static final MeltingLayout.ComponentGroupType INPUT_GROUP
public MeltingLayout(java.awt.Container parent)
parent - the parent Container.public MeltingLayout(java.awt.Container parent,
int hgap,
int vgap)
hgap and the vertical gap
is specified by vgap.parent - the parent Container.hgap - the horizontal gap.vgap - the vertical gap.public void addLayoutComponent(java.awt.Component component,
java.lang.Object constraints)
Container.add method with the same argument types.addLayoutComponent in interface java.awt.LayoutManager2component - the component to be added.constraints - an object that specifies whether the new component
should be added to the label group, or whether it
should be added to the input group.java.lang.IllegalArgumentException - if the constraint object is not an
integer, or if it does not refer to one of the two groups.@Deprecated
public void addLayoutComponent(java.lang.String name,
java.awt.Component component)
addLayoutComponent(Component, Object).addLayoutComponent in interface java.awt.LayoutManagerpublic void removeLayoutComponent(java.awt.Component component)
remove or
removeAll methods. Most applications do not call this method
directly.removeLayoutComponent in interface java.awt.LayoutManagercomponent - the component to be removed.public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
preferredLayoutSize in interface java.awt.LayoutManagerparent - The container to return the preferred size for.public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
minimumLayoutSize in interface java.awt.LayoutManagerparent - The container to return the minimum size for.public java.awt.Dimension maximumLayoutSize(java.awt.Container parent)
maximumLayoutSize in interface java.awt.LayoutManager2parent - The container to return the maximum size for.public void layoutContainer(java.awt.Container target)
The method moves through each label group-input group pair (a 'component line') and decides whether it has space to put the label group and the input group on the same line. If it does, then the left hand edge of the input group is aligned with the left hand edges of all other appended input groups. Otherwise, the input group is placed on a new line. In both cases, the input group is resized in order to take up all available space, or left alone if there is not enough space.
layoutContainer in interface java.awt.LayoutManagertarget - The container in which to do the layout.public float getLayoutAlignmentX(java.awt.Container parent)
getLayoutAlignmentX in interface java.awt.LayoutManager2parent - The parent container.public float getLayoutAlignmentY(java.awt.Container parent)
getLayoutAlignmentY in interface java.awt.LayoutManager2parent - The parent container.public void invalidateLayout(java.awt.Container parent)
invalidateLayout in interface java.awt.LayoutManager2parent - The parent container.public void checkContainer(java.awt.Container target)