Package swingtree.layout
Class MigAddConstraint
java.lang.Object
swingtree.layout.MigAddConstraint
- All Implemented Interfaces:
AddConstraint
A wrapper for mig layout constraint string to avoid the inherent brittleness of strings...
Instances of this are immutable collections of mig layout constraints
which can be merged with other instances of this class through the
Here how this class would typically be used in a swing-tree UI:
and(MigAddConstraint) method,
which is in essence a wither method.
Here how this class would typically be used in a swing-tree UI:
import static swingtree.UI.*;
public class MyView extends JPanel {
public MyView() {
of(this).withLayout(FILL.and(GROW).and(WRAP(3)))
.add(LEFT, label("Name:") )
.add(GROW.and(SPAN), textField("name") )
.add(LEFT, label("Address:") )
.add(GROW.and(SPAN), textField("address") )
}
}
As you can see this class is not used directly, but rather in the form of static constants
as part of the UI class.
You can define your own component constraints as static constants in your own code
by using the of(String...) method.-
Method Summary
Modifier and TypeMethodDescriptionprotected swingtree.layout.AbstractConstraint_and(swingtree.layout.AbstractConstraint attr, swingtree.layout.AbstractConstraint newAttr) Create a newMigAddConstraintwith the provided layout constraints merged with this one.and(MigAddConstraint attr) Create a newMigAddConstraintwith the providedMigAddConstraintmerged with this one.static MigAddConstraintCreate a new CompAttr with the given layout constraintsSupplies the actualObjectthat is used by a particular layout manager to apply the constraint to a component.toString()
-
Method Details
-
of
Create a new CompAttr with the given layout constraints- Parameters:
layoutConstraints- the layout constraints- Returns:
- a new CompAttr, which may represent a single component or a group of layout constraints
-
and
Create a newMigAddConstraintwith the providedMigAddConstraintmerged with this one.- Parameters:
attr- theMigAddConstraintto merge with this one- Returns:
- a new
MigAddConstraintwith the providedMigAddConstraintmerged with this one
-
and
Create a newMigAddConstraintwith the provided layout constraints merged with this one.- Parameters:
layoutConstraints- the string layout constraints to merge with this one- Returns:
- a new
MigAddConstraintwith the provided layout constraints merged with this one
-
toConstraintForLayoutManager
Description copied from interface:AddConstraintSupplies the actualObjectthat is used by a particular layout manager to apply the constraint to a component.- Specified by:
toConstraintForLayoutManagerin interfaceAddConstraint- Returns:
- The
Objectthat is used by a particular layout manager to apply the constraint to a component.
-
_and
protected swingtree.layout.AbstractConstraint _and(swingtree.layout.AbstractConstraint attr, swingtree.layout.AbstractConstraint newAttr) -
toString
-