public final class MigLayout
A very flexible layout manager.
Read the documentation that came with this layout manager for information on usage.
Constructors
Methods
Inherited methods
Constructor details
MigLayout
public MigLayout()MigLayout
public MigLayout(String layoutConstraints)Parameters
layoutConstraintsString- The constraints that concern the whole layout.
nullwill be treated as “”.
MigLayout
public MigLayout(String layoutConstraints, String colConstraints)Parameters
layoutConstraintsString- The constraints that concern the whole layout.
nullwill be treated as “”. colConstraintsString- The constraints for the columns in the grid.
nullwill be treated as “”.
MigLayout
public MigLayout(String layoutConstraints, String colConstraints, String rowConstraints)Parameters
layoutConstraintsString- The constraints that concern the whole layout.
nullwill be treated as “”. colConstraintsString- The constraints for the columns in the grid.
nullwill be treated as “”. rowConstraintsString- The constraints for the rows in the grid.
nullwill be treated as “”.
MigLayout
public MigLayout(LC layoutConstraints)Parameters
layoutConstraintsLC- The constraints that concern the whole layout.
nullwill be treated as an empty constraint.
MigLayout
public MigLayout(LC layoutConstraints, AC colConstraints)Parameters
layoutConstraintsLC- The constraints that concern the whole layout.
nullwill be treated as an empty constraint. colConstraintsAC- The constraints for the columns in the grid.
nullwill be treated as an empty constraint.
MigLayout
public MigLayout(LC layoutConstraints, AC colConstraints, AC rowConstraints)Parameters
layoutConstraintsLC- The constraints that concern the whole layout.
nullwill be treated as an empty constraint. colConstraintsAC- The constraints for the columns in the grid.
nullwill be treated as an empty constraint. rowConstraintsAC- The constraints for the rows in the grid.
nullwill be treated as an empty constraint.
Method details
findType
public static <E> E findType(Class<E> clazz, Component comp)getLayoutConstraints
public Object getLayoutConstraints()String or
net.miginfocom.layout.LC depending what was sent in to the
constructor or set with #setLayoutConstraints(Object).Returns
String or
net.miginfocom.layout.LC depending what was sent in to the
constructor or set with #setLayoutConstraints(Object). Never
null.setLayoutConstraints
public void setLayoutConstraints(Object constr)Sets the layout constraints for the layout manager instance as a String.
See the class JavaDocs for information on how this string is formatted.
Parameters
constrObject- The layout constraints as a String pr
net.miginfocom.layout.LCrepresentation.nullis converted to""for storage.
Throws
RuntimeException- if the constraint was not valid.
getColumnConstraints
public Object getColumnConstraints()String or
net.miginfocom.layout.AC.Returns
String or
net.miginfocom.layout.AC depending what was sent in to the
constructor or set with #setColumnConstraints(Object). Never
null.setColumnConstraints
public void setColumnConstraints(Object constr)Sets the column layout constraints for the layout manager instance as a String.
See the class JavaDocs for information on how this string is formatted.
Parameters
constrObject- The column layout constraints as a String or
net.miginfocom.layout.ACrepresentation.nullis converted to""for storage.
Throws
RuntimeException- if the constraint was not valid.
getRowConstraints
public Object getRowConstraints()String or
net.miginfocom.layout.AC.Returns
String or
net.miginfocom.layout.AC depending what was sent in to the
constructor or set with #setRowConstraints(Object). Never
null.setRowConstraints
public void setRowConstraints(Object constr)Sets the row layout constraints for the layout manager instance as a String.
See the class JavaDocs for information on how this string is formatted.
Parameters
constrObject- The row layout constraints as a String or
net.miginfocom.layout.ACrepresentation.nullis converted to""for storage.
Throws
RuntimeException- if the constraint was not valid.
getConstraintMap
public Map<Component, Object> getConstraintMap()Returns
null.setConstraintMap
public void setConstraintMap(Map<Component, Object> map)Parameters
mapMap<Component, Object>- The map. Will be copied.
getComponentConstraints
public Object getComponentConstraints(Component comp)Returns the component constraints as a String representation. This string
is the exact string as set with
Object) or set when
adding the component to the parent component.
See the class JavaDocs for information on how this string is formatted.
Parameters
compComponent- The component to return the constraints for.
Returns
null if the component is not registered with this layout
manager. The returned values is either a String or a
net.miginfocom.layout.CC depending on what constraint was sent in
when the component was added. May be null.setComponentConstraints
public void setComponentConstraints(Component comp, Object constr)Sets the component constraint for the component that already must be handled by this layout manager.
See the class JavaDocs for information on how this string is formatted.
Parameters
compComponent- The component to set the constraints for.
constrObject- The component constraints as a String or
net.miginfocom.layout.CC.nullis ok.
Throws
RuntimeException- if the constraint was not valid.
IllegalArgumentException- If the component is not handling the component.
isManagingComponent
public boolean isManagingComponent(Component c)Parameters
cComponent- The component to check. If
nullthenfalsewill be returned.
Returns
addLayoutCallback
public void addLayoutCallback(LayoutCallback callback)Parameters
callbackLayoutCallback- The callback. Not
null.
removeLayoutCallback
public void removeLayoutCallback(LayoutCallback callback)Parameters
callbackLayoutCallback- The callback. May be
null.
layoutContainer
public void layoutContainer(Container parent)Parameters
parentContainer- the given parent container
minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)Parameters
parentContainer- The parent who’s window to possibly adjust the size for.
preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)maximumLayoutSize
public Dimension maximumLayoutSize(Container parent)getLayoutAlignmentX
public float getLayoutAlignmentX(Container parent)getLayoutAlignmentY
public float getLayoutAlignmentY(Container parent)addLayoutComponent
public void addLayoutComponent(Object value, Component comp, Container c)Parameters
valueObject- optional meta data information, like alignment orientation
compComponent- the added component to the layout
cContainer- the parent container
addLayoutComponent
public void addLayoutComponent(Component comp, Object constraints)isConstraintTracking
public boolean isConstraintTracking()Returns
getComponentConstraint
public Object getComponentConstraint(Component comp)Parameters
compComponent- the component whose constraint should be returned
Returns
removeLayoutComponent
public void removeLayoutComponent(Component comp)Parameters
compComponent- the removed component from layout
invalidateLayout
public void invalidateLayout(Container target)getPreferredSize
public Dimension getPreferredSize(Container parent)Parameters
parentContainer- the parent container