java.lang.Object
net.miginfocom.swing.MigLayout
- All Implemented Interfaces:
LayoutManager,LayoutManager2,Externalizable,Serializable
A very flexible layout manager.
Read the documentation that came with this layout manager for information on usage.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with no constraints.Constructor.Constructor.Constructor.Constructor.Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLayoutCallback(LayoutCallback callback) Adds the callback function that will be called at different stages of the layout cylce.voidaddLayoutComponent(Component comp, Object constraints) voidaddLayoutComponent(String s, Component comp) Returns the column layout constraints either as aStringorAC.Returns the component constraints as a String representation.Returns a shallow copy of the constraints map.floatgetLayoutAlignmentX(Container parent) floatgetLayoutAlignmentY(Container parent) Returns layout constraints either as aStringorLCdepending what was sent in to the constructor or set withsetLayoutConstraints(Object).Returns the row layout constraints as a String representation.voidinvalidateLayout(Container target) booleanReturns if this layout manager is currently managing this component.voidlayoutContainer(Container parent) maximumLayoutSize(Container parent) minimumLayoutSize(Container parent) preferredLayoutSize(Container parent) voidvoidremoveLayoutCallback(LayoutCallback callback) Removes the callback if it exists.voidvoidsetColumnConstraints(Object constr) Sets the column layout constraints for the layout manager instance as a String.voidsetComponentConstraints(Component comp, Object constr) Sets the component constraint for the component that already must be handled by this layout manager.voidsetConstraintMap(Map<Component, Object> map) Sets the constraints map.voidsetLayoutConstraints(Object constr) Sets the layout constraints for the layout manager instance as a String.voidsetRowConstraints(Object constr) Sets the row layout constraints for the layout manager instance as a String.void
-
Constructor Details
-
MigLayout
public MigLayout()Constructor with no constraints. -
MigLayout
Constructor.- Parameters:
layoutConstraints- The constraints that concern the whole layout.nullwill be treated as "".
-
MigLayout
Constructor.- Parameters:
layoutConstraints- The constraints that concern the whole layout.nullwill be treated as "".colConstraints- The constraints for the columns in the grid.nullwill be treated as "".
-
MigLayout
Constructor.- Parameters:
layoutConstraints- The constraints that concern the whole layout.nullwill be treated as "".colConstraints- The constraints for the columns in the grid.nullwill be treated as "".rowConstraints- The constraints for the rows in the grid.nullwill be treated as "".
-
MigLayout
Constructor.- Parameters:
layoutConstraints- The constraints that concern the whole layout.nullwill be treated as an empty constraint.
-
MigLayout
Constructor.- Parameters:
layoutConstraints- The constraints that concern the whole layout.nullwill be treated as an empty constraint.colConstraints- The constraints for the columns in the grid.nullwill be treated as an empty constraint.
-
MigLayout
Constructor.- Parameters:
layoutConstraints- The constraints that concern the whole layout.nullwill be treated as an empty constraint.colConstraints- The constraints for the columns in the grid.nullwill be treated as an empty constraint.rowConstraints- The constraints for the rows in the grid.nullwill be treated as an empty constraint.
-
-
Method Details
-
getLayoutConstraints
Returns layout constraints either as aStringorLCdepending what was sent in to the constructor or set withsetLayoutConstraints(Object).- Returns:
- The layout constraints either as a
StringorLCdepending what was sent in to the constructor or set withsetLayoutConstraints(Object). Nevernull.
-
setLayoutConstraints
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:
constr- The layout constraints as a String representation.nullis converted to""for storage.- Throws:
RuntimeException- if the constraint was not valid.
-
getColumnConstraints
Returns the column layout constraints either as aStringorAC.- Returns:
- The column constraints either as a
StringorLCdepending what was sent in to the constructor or set withsetLayoutConstraints(Object). Nevernull.
-
setColumnConstraints
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:
constr- The column layout constraints as a String representation.nullis converted to""for storage.- Throws:
RuntimeException- if the constraint was not valid.
-
getRowConstraints
Returns the row layout constraints as a String representation. This string is the exact string as set withsetRowConstraints(Object)or sent into the constructor.See the class JavaDocs for information on how this string is formatted.
- Returns:
- The row layout constraints as a String representation. Never
null.
-
setRowConstraints
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:
constr- The row layout constraints as a String representation.nullis converted to""for storage.- Throws:
RuntimeException- if the constraint was not valid.
-
getConstraintMap
Returns a shallow copy of the constraints map.- Returns:
- A shallow copy of the constraints map. Never
null.
-
setConstraintMap
Sets the constraints map.- Parameters:
map- The map. Will be copied.
-
getComponentConstraints
Returns the component constraints as a String representation. This string is the exact string as set withsetComponentConstraints(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.
- Parameters:
comp- The component to return the constraints for.- Returns:
- The component constraints as a String representation or
nullif the component is not registered with this layout manager. The returned values is either a String or aCCdepending on what constraint was sent in when the component was added. May benull.
-
setComponentConstraints
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:
comp- The component to set the constraints for.constr- The component constraints as a String orCC.nullis ok.- Throws:
RuntimeException- if the constraint was not valid.IllegalArgumentException- If the component is not handling the component.
-
isManagingComponent
Returns if this layout manager is currently managing this component.- Parameters:
c- The component to check. Ifnullthenfalsewill be returned.- Returns:
- If this layout manager is currently managing this component.
-
addLayoutCallback
Adds the callback function that will be called at different stages of the layout cylce.- Parameters:
callback- The callback. Notnull.
-
removeLayoutCallback
Removes the callback if it exists.- Parameters:
callback- The callback. May benull.
-
layoutContainer
- Specified by:
layoutContainerin interfaceLayoutManager
-
minimumLayoutSize
- Specified by:
minimumLayoutSizein interfaceLayoutManager
-
preferredLayoutSize
- Specified by:
preferredLayoutSizein interfaceLayoutManager
-
maximumLayoutSize
- Specified by:
maximumLayoutSizein interfaceLayoutManager2
-
getLayoutAlignmentX
- Specified by:
getLayoutAlignmentXin interfaceLayoutManager2
-
getLayoutAlignmentY
- Specified by:
getLayoutAlignmentYin interfaceLayoutManager2
-
addLayoutComponent
- Specified by:
addLayoutComponentin interfaceLayoutManager
-
addLayoutComponent
- Specified by:
addLayoutComponentin interfaceLayoutManager2
-
removeLayoutComponent
- Specified by:
removeLayoutComponentin interfaceLayoutManager
-
invalidateLayout
- Specified by:
invalidateLayoutin interfaceLayoutManager2
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-