public class MigLayout extends Object implements LayoutManager2, Externalizable
Read the documentation that came with this layout manager for information on usage.
Constructor and Description |
---|
MigLayout()
Constructor with no constraints.
|
MigLayout(LC layoutConstraints)
Constructor.
|
MigLayout(LC layoutConstraints,
AC colConstraints)
Constructor.
|
MigLayout(LC layoutConstraints,
AC colConstraints,
AC rowConstraints)
Constructor.
|
MigLayout(String layoutConstraints)
Constructor.
|
MigLayout(String layoutConstraints,
String colConstraints)
Constructor.
|
MigLayout(String layoutConstraints,
String colConstraints,
String rowConstraints)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addLayoutCallback(LayoutCallback callback)
Adds the callback function that will be called at different stages of the layout cycle.
|
void |
addLayoutComponent(Component comp,
Object constraints) |
void |
addLayoutComponent(String s,
Component comp) |
static <E> E |
findType(Class<E> clazz,
Component comp) |
Object |
getColumnConstraints()
Returns the column layout constraints either as a
String or AC . |
Object |
getComponentConstraints(Component comp)
Returns the component constraints as a String representation.
|
Map<Component,Object> |
getConstraintMap()
Returns a shallow copy of the constraints map.
|
float |
getLayoutAlignmentX(Container parent) |
float |
getLayoutAlignmentY(Container parent) |
Object |
getLayoutConstraints()
Returns layout constraints either as a
String or LC depending what was sent in
to the constructor or set with setLayoutConstraints(Object) . |
Object |
getRowConstraints()
Returns the row layout constraints either as a
String or AC . |
void |
invalidateLayout(Container target) |
boolean |
isManagingComponent(Component c)
Returns if this layout manager is currently managing this component.
|
void |
layoutContainer(Container parent) |
Dimension |
maximumLayoutSize(Container parent) |
Dimension |
minimumLayoutSize(Container parent) |
Dimension |
preferredLayoutSize(Container parent) |
void |
readExternal(ObjectInput in) |
void |
removeLayoutCallback(LayoutCallback callback)
Removes the callback if it exists.
|
void |
removeLayoutComponent(Component comp) |
void |
setColumnConstraints(Object constr)
Sets the column layout constraints for the layout manager instance as a String.
|
void |
setComponentConstraints(Component comp,
Object constr)
Sets the component constraint for the component that already must be handled by this layout manager.
|
void |
setConstraintMap(Map<Component,Object> map)
Sets the constraints map.
|
void |
setLayoutConstraints(Object constr)
Sets the layout constraints for the layout manager instance as a String.
|
void |
setRowConstraints(Object constr)
Sets the row layout constraints for the layout manager instance as a String.
|
void |
writeExternal(ObjectOutput out) |
public MigLayout()
public MigLayout(String layoutConstraints)
layoutConstraints
- The constraints that concern the whole layout. null
will be treated as "".public MigLayout(String layoutConstraints, String colConstraints)
layoutConstraints
- The constraints that concern the whole layout. null
will be treated as "".colConstraints
- The constraints for the columns in the grid. null
will be treated as "".public MigLayout(String layoutConstraints, String colConstraints, String rowConstraints)
layoutConstraints
- The constraints that concern the whole layout. null
will be treated as "".colConstraints
- The constraints for the columns in the grid. null
will be treated as "".rowConstraints
- The constraints for the rows in the grid. null
will be treated as "".public MigLayout(LC layoutConstraints)
layoutConstraints
- The constraints that concern the whole layout. null
will be treated as an empty constraint.public MigLayout(LC layoutConstraints, AC colConstraints)
layoutConstraints
- The constraints that concern the whole layout. null
will be treated as an empty constraint.colConstraints
- The constraints for the columns in the grid. null
will be treated as an empty constraint.public MigLayout(LC layoutConstraints, AC colConstraints, AC rowConstraints)
layoutConstraints
- The constraints that concern the whole layout. null
will be treated as an empty constraint.colConstraints
- The constraints for the columns in the grid. null
will be treated as an empty constraint.rowConstraints
- The constraints for the rows in the grid. null
will be treated as an empty constraint.public Object getLayoutConstraints()
String
or LC
depending what was sent in
to the constructor or set with setLayoutConstraints(Object)
.String
or LC
depending what was sent in
to the constructor or set with setLayoutConstraints(Object)
. Never null
.public void setLayoutConstraints(Object constr)
See the class JavaDocs for information on how this string is formatted.
constr
- The layout constraints as a String or LC
representation. null
is converted to ""
for storage.RuntimeException
- if the constraint was not valid.public Object getColumnConstraints()
String
or AC
.String
or AC
depending what was sent in
to the constructor or set with setColumnConstraints(Object)
. Never null
.public void setColumnConstraints(Object constr)
See the class JavaDocs for information on how this string is formatted.
constr
- The column layout constraints as a String or AC
representation. null
is converted to ""
for storage.RuntimeException
- if the constraint was not valid.public Object getRowConstraints()
String
or AC
.String
or AC
depending what was sent in
to the constructor or set with setRowConstraints(Object)
. Never null
.public void setRowConstraints(Object constr)
See the class JavaDocs for information on how this string is formatted.
constr
- The row layout constraints as a String or AC
representation. null
is converted to ""
for storage.RuntimeException
- if the constraint was not valid.public Map<Component,Object> getConstraintMap()
null
.public void setConstraintMap(Map<Component,Object> map)
map
- The map. Will be copied.public Object getComponentConstraints(Component comp)
setComponentConstraints(java.awt.Component, Object)
or set when adding the component to the parent component.
See the class JavaDocs for information on how this string is formatted.
comp
- The component to return the constraints for.null
if the component is not registered
with this layout manager. The returned values is either a String or a CC
depending on what constraint was sent in when the component was added. May be null
.public void setComponentConstraints(Component comp, Object constr)
See the class JavaDocs for information on how this string is formatted.
constr
- The component constraints as a String or CC
. null
is ok.comp
- The component to set the constraints for.RuntimeException
- if the constraint was not valid.IllegalArgumentException
- If the component is not handling the component.public boolean isManagingComponent(Component c)
c
- The component to check. If null
then false
will be returned.public void addLayoutCallback(LayoutCallback callback)
callback
- The callback. Not null
.public void removeLayoutCallback(LayoutCallback callback)
callback
- The callback. May be null
.public void layoutContainer(Container parent)
layoutContainer
in interface LayoutManager
public Dimension minimumLayoutSize(Container parent)
minimumLayoutSize
in interface LayoutManager
public Dimension preferredLayoutSize(Container parent)
preferredLayoutSize
in interface LayoutManager
public Dimension maximumLayoutSize(Container parent)
maximumLayoutSize
in interface LayoutManager2
public float getLayoutAlignmentX(Container parent)
getLayoutAlignmentX
in interface LayoutManager2
public float getLayoutAlignmentY(Container parent)
getLayoutAlignmentY
in interface LayoutManager2
public void addLayoutComponent(String s, Component comp)
addLayoutComponent
in interface LayoutManager
public void addLayoutComponent(Component comp, Object constraints)
addLayoutComponent
in interface LayoutManager2
public void removeLayoutComponent(Component comp)
removeLayoutComponent
in interface LayoutManager
public void invalidateLayout(Container target)
invalidateLayout
in interface LayoutManager2
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
Copyright © 2007–2018. All rights reserved.