Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   package net.miginfocom.layout;
   
   import java.io.*;
   /*
    * License (BSD):
    * ==============
    *
    * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (miglayout (at) miginfocom (dot) com)
    * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modification,
   * are permitted provided that the following conditions are met:
   * Redistributions of source code must retain the above copyright notice, this list
   * of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice, this
   * list of conditions and the following disclaimer in the documentation and/or other
   * materials provided with the distribution.
   * Neither the name of the MiG InfoCom AB nor the names of its contributors may be
   * used to endorse or promote products derived from this software without specific
   * prior written permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
   * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
   * OF SUCH DAMAGE.
   *
   * @version 1.0
   * @author Mikael Grev, MiG InfoCom AB
   *         Date: 2006-sep-08
   */

Contains the constraints for an instance of the LC layout manager.
  
  public final class LC implements Externalizable
  {
  	// See the corresponding set/get method for documentation of the property!
  
  	private int wrapAfter = .;
  
  	private Boolean leftToRight = null;
  
  	private UnitValue[] insets = null;    // Never null elememts but if unset array is null
  
  	private UnitValue alignX = nullalignY = null;
  
  	private BoundSize gridGapX = nullgridGapY = null;
  
  
  
  	private float pwAlign = 0.5f, phAlign = 1.0f;
  
  	private int debugMillis = 0;
  
  	private int hideMode = 0;
  
  	private boolean noCache = false;
  
  	private boolean flowX = true;
  
  	private boolean fillX = falsefillY = false;
  
  	private boolean topToBottom = true;
  
  	private boolean noGrid = false;
  
  	private boolean visualPadding = true;

Empty constructor.
  
  	public LC()
  	{
  	}
  
  	// ************************************************************************
  	// * JavaBean get/set methods.
  	// ************************************************************************
  

If components have sizes or positions linked to the bounds of the parent in some way (as for instance the "%" unit has) the cache must be turned off for the panel. If components does not get the correct or expected size or position try to set this property to true.

Returns:
true means no cache and slightly slower layout.
  
  	public boolean isNoCache()
  	{
  		return ;
  	}

If components have sizes or positions linked to the bounds of the parent in some way (as for instance the "%" unit has) the cache must be turned off for the panel. If components does not get the correct or expected size or position try to set this property to true.

Parameters:
b true means no cache and slightly slower layout.
  
 	public void setNoCache(boolean b)
 	{
 		this. = b;
 	}

If the laid out components' bounds in total is less than the final size of the container these align values will be used to align the components in the parent. null is default and that means top/left alignment. The relative distances between the components will not be affected by this property.

Returns:
The current alignment.
 
 	public final UnitValue getAlignX()
 	{
 		return ;
 	}

If the laid out components' bounds in total is less than the final size of the container these align values will be used to align the components in the parent. null is default and that means top/left alignment. The relative distances between the components will not be affected by this property.

Parameters:
uv The new alignment. Use ConstraintParser.parseAlignKeywords(java.lang.String,boolean) to create the UnitValue. May be null.
 
 	public final void setAlignX(UnitValue uv)
 	{
 		this. = uv;
 	}

If the laid out components' bounds in total is less than the final size of the container these align values will be used to align the components in the parent. null is default and that means top/left alignment. The relative distances between the components will not be affected by this property.

Returns:
The current alignment.
 
 	public final UnitValue getAlignY()
 	{
 		return ;
 	}

If the laid out components' bounds in total is less than the final size of the container these align values will be used to align the components in the parent. null is default and that means top/left alignment. The relative distances between the components will not be affected by this property.

Parameters:
uv The new alignment. Use ConstraintParser.parseAlignKeywords(java.lang.String,boolean) to create the UnitValue. May be null.
 
 	public final void setAlignY(UnitValue uv)
 	{
 		this. = uv;
 	}

If > 0 the debug decorations will be repainted every millis. No debug information if <= 0 (default).

Returns:
The current debug repaint interval.
 
 	public final int getDebugMillis()
 	{
 		return ;
 	}

If > 0 the debug decorations will be repainted every millis. No debug information if <= 0 (default).

Parameters:
millis The new debug repaint interval.
 
 	public final void setDebugMillis(int millis)
 	{
 		this. = millis;
 	}

If the layout should always claim the whole bounds of the laid out container even if the preferred size is smaller.

Returns:
true means fill. false is default.
 
 	public final boolean isFillX()
 	{
 		return ;
 	}

If the layout should always claim the whole bounds of the laid out container even if the preferred size is smaller.

Parameters:
b true means fill. false is default.
 
 	public final void setFillX(boolean b)
 	{
 		this. = b;
 	}

If the layout should always claim the whole bounds of the laid out container even if the preferred size is smaller.

Returns:
true means fill. false is default.
 
 	public final boolean isFillY()
 	{
 		return ;
 	}

If the layout should always claim the whole bounds of the laid out container even if the preferred size is smaller.

Parameters:
b true means fill. false is default.
 
 	public final void setFillY(boolean b)
 	{
 		this. = b;
 	}

The default flow direction. Normally (which is true) this is horizontal and that means that the "next" component will be put in the cell to the right (or to the left if left-to-right is false).

Returns:
true is the default flow horizontally.
See also:
setLeftToRight(java.lang.Boolean)
 
 	public final boolean isFlowX()
 	{
 		return ;
 	}

The default flow direction. Normally (which is true) this is horizontal and that means that the "next" component will be put in the cell to the right (or to the left if left-to-right is false).

Parameters:
b true is the default flow horizontally.
See also:
setLeftToRight(java.lang.Boolean)
 
 	public final void setFlowX(boolean b)
 	{
 		this. = b;
 	}

If non-null (null is default) these value will be used as the default gaps between the columns in the grid.

Returns:
The default grid gap between columns in the grid. null if the platform default is used.
 
 	public final BoundSize getGridGapX()
 	{
 		return ;
 	}

If non-null (null is default) these value will be used as the default gaps between the columns in the grid.

Parameters:
x The default grid gap between columns in the grid. If null the platform default is used.
 
 	public final void setGridGapX(BoundSize x)
 	{
 		this. = x;
 	}

If non-null (null is default) these value will be used as the default gaps between the rows in the grid.

Returns:
The default grid gap between rows in the grid. null if the platform default is used.
 
 	public final BoundSize getGridGapY()
 	{
 		return ;
 	}

If non-null (null is default) these value will be used as the default gaps between the rows in the grid.

Parameters:
y The default grid gap between rows in the grid. If null the platform default is used.
 
 	public final void setGridGapY(BoundSize y)
 	{
 		this. = y;
 	}

How a component that is hidden (not visible) should be treated by default.

Returns:
The mode:
0 == Normal. Bounds will be caclulated as if the component was visible.
1 == If hidden the size will be 0, 0 but the gaps remain.
2 == If hidden the size will be 0, 0 and gaps set to zero.
3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
 
 	public final int getHideMode()
 	{
 		return ;
 	}

How a component that is hidden (not visible) should be treated.

Parameters:
mode The mode:
0 == Normal. Bounds will be caclulated as if the component was visible.
1 == If hidden the size will be 0, 0 but the gaps remain.
2 == If hidden the size will be 0, 0 and gaps set to zero.
3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
 
 	public final void setHideMode(int mode)
 	{
 		if (mode < 0 || mode > 3)
 			throw new IllegalArgumentException("Wrong hideMode: " + mode);
 
 		this. = mode;
 	}

The insets for the layed out panel. The insets will be an empty space around the components in the panel. null values means that the default panel insets for the platform is used. See PlatformDefaults.setDialogInsets(net.miginfocom.layout.UnitValue,net.miginfocom.layout.UnitValue,net.miginfocom.layout.UnitValue,net.miginfocom.layout.UnitValue).

Returns:
The insets. Of length 4 (top, left, bottom, right) or null. The elements (1 to 4) may be null. The array is a copy and can be used freely.
See also:
ConstraintParser.parseInsets(java.lang.String,boolean)
 
 	public final UnitValue[] getInsets()
 	{
 		return  != null ? new UnitValue[] {[0], [1], [2], [3]} : null;
 	}

The insets for the layed out panel. The insets will be an empty space around the components in the panel. null values means that the default panel insets for the platform is used. See PlatformDefaults.setDialogInsets(net.miginfocom.layout.UnitValue,net.miginfocom.layout.UnitValue,net.miginfocom.layout.UnitValue,net.miginfocom.layout.UnitValue).

Parameters:
ins The new insets. Must be of length 4 (top, left, bottom, right) or null. The elements (1 to 4) may be null to use the platform default for that side. The array is copied for storage.
See also:
ConstraintParser.parseInsets(java.lang.String,boolean)
 
 	public final void setInsets(UnitValue[] ins)
 	{
 		this. = ins != null ? new UnitValue[] {ins[0], ins[1], ins[2], ins[3]} : null;
 	}

If the layout should be forced to be left-to-right or right-to-left. A value of null is default and means that this will be picked up from the java.util.Locale that the container being layed out is reporting.

Returns:
Boolean.TRUE if force left-to-right. Boolean.FALSE if force tight-to-left. null for the default "let the current Locale decide".
 
 	public final Boolean getLeftToRight()
 	{
 		return ;
 	}

If the layout should be forced to be left-to-right or right-to-left. A value of null is default and means that this will be picked up from the java.util.Locale that the container being layed out is reporting.

Parameters:
b Boolean.TRUE to force left-to-right. Boolean.FALSE to force tight-to-left. null for the default "let the current Locale decide".
 
 	public final void setLeftToRight(Boolean b)
 	{
 		this. = b;
 	}

If the whole layout should be non grid based. It is the same as setting the "nogrid" property on every row/column in the grid.

Returns:
true means not grid based. false is default.
 
 	public final boolean isNoGrid()
 	{
 		return ;
 	}

If the whole layout should be non grid based. It is the same as setting the "nogrid" property on every row/column in the grid.

Parameters:
b true means no grid. false is default.
 
 	public final void setNoGrid(boolean b)
 	{
 		this. = b;
 	}

If the layout should go from the default top-to-bottom in the grid instead of the optinal bottom-to-top.

Returns:
true for the default top-to-bottom.
 
 	public final boolean isTopToBottom()
 	{
 		return ;
 	}

If the layout should go from the default top-to-bottom in the grid instead of the optinal bottom-to-top.

Parameters:
b true for the default top-to-bottom.
 
 	public final void setTopToBottom(boolean b)
 	{
 		this. = b;
 	}

If visual padding should be automatically used and compensated for by this layout instance.

Returns:
true if visual padding.
 
 	public final boolean isVisualPadding()
 	{
 		return ;
 	}

If visual padding should be automatically used and compensated for by this layout instance.

Parameters:
b true turns on visual padding.
 
 	public final void setVisualPadding(boolean b)
 	{
 		this. = b;
 	}

Returns after what cell the grid should always auto wrap.

Returns:
After what cell the grid should always auto wrap. If 0 the number of columns/rows in the AC is used. LayoutUtil.INF is used for no auto wrap.
 
 	public final int getWrapAfter()
 	{
 		return ;
 	}

Sets after what cell the grid should always auto wrap.

Parameters:
count After what cell the grid should always auto wrap. If 0 the number of columns/rows in the AC is used. LayoutUtil.INF is used for no auto wrap.
 
 	public final void setWrapAfter(int count)
 	{
 		this. = count;
 	}

Returns the "pack width" for the window that this container is located in. When the size of this container changes the size of the window will be corrected to be within this BoundsSize. It can be used to set the minimum and/or maximum size of the window as well as the size window should optimally get. This optimal size is normaly its "preferred" size which is why "preferred" is the normal value to set here.

":push" can be appended to the bound size to only push the size bigger and never shrink it if the preferred size gets smaller.

E.g. "pref", "100:pref", "pref:700", "300::700", "pref:push"

Returns:
The current value. Never null. Check if not set with .isUnset().
Since:
3.5
 
 	public final BoundSize getPackWidth()
 	{
 		return ;
 	}

Sets the "pack width" for the window that this container is located in. When the size of this container changes the size of the window will be corrected to be within this BoundsSize. It can be used to set the minimum and/or maximum size of the window as well as the size window should optimally get. This optimal size is normaly its "preferred" size which is why "preferred" is the normal value to set here.

":push" can be appended to the bound size to only push the size bigger and never shrink it if the preferred size gets smaller.

E.g. "pref", "100:pref", "pref:700", "300::700", "pref:push"

Parameters:
size The new pack size. If null it will be corrected to an "unset" BoundSize.
Since:
3.5
 
 	public final void setPackWidth(BoundSize size)
 	{
 		 = size != null ? size : .;
 	}

Returns the "pack height" for the window that this container is located in. When the size of this container changes the size of the window will be corrected to be within this BoundsSize. It can be used to set the minimum and/or maximum size of the window as well as the size window should optimally get. This optimal size is normaly its "preferred" size which is why "preferred" is the normal value to set here.

":push" can be appended to the bound size to only push the size bigger and never shrink it if the preferred size gets smaller.

E.g. "pref", "100:pref", "pref:700", "300::700", "pref:push"

Returns:
The current value. Never null. Check if not set with .isUnset().
Since:
3.5
 
 	public final BoundSize getPackHeight()
 	{
 		return ;
 	}

Sets the "pack height" for the window that this container is located in. When the size of this container changes the size of the window will be corrected to be within this BoundsSize. It can be used to set the minimum and/or maximum size of the window as well as the size window should optimally get. This optimal size is normaly its "preferred" size which is why "preferred" is the normal value to set here.

":push" can be appended to the bound size to only push the size bigger and never shrink it if the preferred size gets smaller.

E.g. "pref", "100:pref", "pref:700", "300::700", "pref:push"

Parameters:
size The new pack size. If null it will be corrected to an "unset" BoundSize.
Since:
3.5
 
 	public final void setPackHeight(BoundSize size)
 	{
 		 = size != null ? size : .;
 	}


If there is a resize of the window due to packing (see setPackHeight(net.miginfocom.layout.BoundSize) this value, which is between 0f and 1f, decides where the extra/surpurflous size is placed. 0f means that the window will resize so that the upper part moves up and the lower side stays in the same place. 0.5f will expand/reduce the window equally upwards and downwards. 1f will do the opposite of 0f of course.

Returns:
The pack alignment. Always between 0f and 1f, inclusive.
Since:
3.5
 
 	public final float getPackHeightAlign()
 	{
 		return ;
 	}

If there is a resize of the window due to packing (see setPackHeight(net.miginfocom.layout.BoundSize) this value, which is between 0f and 1f, decides where the extra/surpurflous size is placed. 0f means that the window will resize so that the upper part moves up and the lower side stays in the same place. 0.5f will expand/reduce the window equally upwards and downwards. 1f will do the opposite of 0f of course.

Parameters:
align The pack alignment. Always between 0f and 1f, inclusive. Values outside this will be truncated.
Since:
3.5
 
 	public final void setPackHeightAlign(float align)
 	{
 		 = Math.max(0f, Math.min(1f, align));
 	}

If there is a resize of the window due to packing (see setPackHeight(net.miginfocom.layout.BoundSize) this value, which is between 0f and 1f, decides where the extra/surpurflous size is placed. 0f means that the window will resize so that the left part moves left and the right side stays in the same place. 0.5f will expand/reduce the window equally to the right and lefts. 1f will do the opposite of 0f of course.

Returns:
The pack alignment. Always between 0f and 1f, inclusive.
Since:
3.5
 
 	public final float getPackWidthAlign()
 	{
 		return ;
 	}

If there is a resize of the window due to packing (see setPackHeight(net.miginfocom.layout.BoundSize) this value, which is between 0f and 1f, decides where the extra/surpurflous size is placed. 0f means that the window will resize so that the left part moves left and the right side stays in the same place. 0.5f will expand/reduce the window equally to the right and lefts. 1f will do the opposite of 0f of course.

Parameters:
align The pack alignment. Always between 0f and 1f, inclusive. Values outside this will be truncated.
Since:
3.5
 
 	public final void setPackWidthAlign(float align)
 	{
 		 = Math.max(0f, Math.min(1f, align));
 	}

Returns the minimum/preferred/maximum size for the container that this layout constraint is set for. Any of these sizes that is not null will be returned directly instead of determining the correspondig size through asking the components in this container.

Returns:
The width for the container that this layout constraint is set for. Not null but all sizes can be null.
Since:
3.5
 
 	public final BoundSize getWidth()
 	{
 		return ;
 	}

Sets the minimum/preferred/maximum size for the container that this layout constraint is set for. Any of these sizes that is not null will be returned directly instead of determining the correspondig size through asking the components in this container.

Parameters:
size The width for the container that this layout constraint is set for. null is translated to a bound size containing only null sizes.
Since:
3.5
 
 	public final void setWidth(BoundSize size)
 	{
 		this. = size != null ? size : .;
 	}

Returns the minimum/preferred/maximum size for the container that this layout constraint is set for. Any of these sizes that is not null will be returned directly instead of determining the correspondig size through asking the components in this container.

Returns:
The height for the container that this layout constraint is set for. Not null but all sizes can be null.
Since:
3.5
 
 	public final BoundSize getHeight()
 	{
 		return ;
 	}

Sets the minimum/preferred/maximum size for the container that this layout constraint is set for. Any of these sizes that is not null will be returned directly instead of determining the correspondig size through asking the components in this container.

Parameters:
size The height for the container that this layout constraint is set for. null is translated to a bound size containing only null sizes.
Since:
3.5
 
 	public final void setHeight(BoundSize size)
 	{
 		this. = size != null ? size : .;
 	}
 
 	// ************************************************************************
 	// * Builder methods.
 	// ************************************************************************
 
Short for, and thus same as, .pack("pref", "pref").

Same functionality as setPackHeight(net.miginfocom.layout.BoundSize) and setPackWidth(net.miginfocom.layout.BoundSize) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
Since:
3.5
 
 	public final LC pack()
 	{
 		return pack("pref""pref");
 	}

Sets the pack width and height.

Same functionality as setPackHeight(net.miginfocom.layout.BoundSize) and setPackWidth(net.miginfocom.layout.BoundSize) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
width The pack width. May be null.
height The pack height. May be null.
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
Since:
3.5
 
 	public final LC pack(String widthString height)
 	{
 		setPackWidth(width != null ? ConstraintParser.parseBoundSize(widthfalsefalse) : .);
 		setPackHeight(height != null ? ConstraintParser.parseBoundSize(heightfalsefalse) : .);
 		return this;
 	}

Sets the pack width and height alignment.

Same functionality as setPackHeightAlign(float) and setPackWidthAlign(float) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
alignX The pack width alignment. 0.5f is default.
alignY The pack height alignment. 0.5f is default.
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
Since:
3.5
 
 	public final LC packAlign(float alignXfloat alignY)
 	{
 		return this;
 	}

Sets a wrap after the number of columns/rows that is defined in the AC.

Same functionality as setWrapAfter(int 0) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC wrap()
 	{
 		return this;
 	}

Same functionality as setWrapAfter(int) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
count After what cell the grid should always auto wrap. If 0 the number of columns/rows in the
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC wrapAfter(int count)
 	{
 		setWrapAfter(count);
 		return this;
 	}

Same functionality as setNoCache(boolean true) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC noCache()
 	{
 		setNoCache(true);
 		return this;
 	}

Same functionality as setFlowX(boolean false) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC flowY()
 	{
 		setFlowX(false);
 		return this;
 	}

Same functionality as setFlowX(boolean true) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC flowX()
 	{
 		setFlowX(true);
 		return this;
 	}

Same functionality as setFillX(boolean true) and setFillY(boolean true) conmbined.T his method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC fill()
 	{
 		setFillX(true);
 		setFillY(true);
 		return this;
 	}

Same functionality as setFillX(boolean true) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC fillX()
 	{
 		setFillX(true);
 		return this;
 	}

Same functionality as setFillY(boolean true) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC fillY()
 	{
 		setFillY(true);
 		return this;
 	}

Same functionality as setLeftToRight(java.lang.Boolean) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
b true for forcing left-to-right. false for forcing right-to-left.
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC leftToRight(boolean b)
 	{
 		return this;
 	}

Same functionality as setLeftToRight(false) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
Since:
3.7.2
 
 	public final LC rightToLeft()
 	{
 		return this;
 	}

Same functionality as setTopToBottom(boolean false) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC bottomToTop()
 	{
 		return this;
 	}

Same functionality as setTopToBottom(boolean true) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
Since:
3.7.2
 
 	public final LC topToBottom()
 	{
 		return this;
 	}

Same functionality as setNoGrid(boolean true) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC noGrid()
 	{
 		setNoGrid(true);
 		return this;
 	}

Same functionality as setVisualPadding(boolean false) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC noVisualPadding()
 	{
 		return this;
 	}

Sets the same inset (expressed as a UnitValue, e.g. "10px" or "20mm") all around.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
allSides The unit value to set for all sides. May be null which means that the default panel insets for the platform is used.
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
setInsets(net.miginfocom.layout.UnitValue[])
 
 	public final LC insetsAll(String allSides)
 	{
 		UnitValue insH = ConstraintParser.parseUnitValue(allSidestrue);
 		UnitValue insV = ConstraintParser.parseUnitValue(allSidesfalse);
 		 = new UnitValue[] {insVinsHinsVinsH}; // No setter to avoid copy again
 		return this;
 	}

Same functionality as setInsets(ConstraintParser.parseInsets(s, true)). This method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
s The string to parse. E.g. "10 10 10 10" or "20". If less than 4 groups the last will be used for the missing.
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
setInsets(net.miginfocom.layout.UnitValue[])
 
 	public final LC insets(String s)
 	{
 		 = ConstraintParser.parseInsets(strue);
 		return this;
 	}

Sets the different insets (expressed as a UnitValues, e.g. "10px" or "20mm") for the corresponding sides.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
top The top inset. E.g. "10px" or "10mm" or "related". May be null in which case the default inset for this side for the platform will be used.
left The left inset. E.g. "10px" or "10mm" or "related". May be null in which case the default inset for this side for the platform will be used.
bottom The bottom inset. E.g. "10px" or "10mm" or "related". May be null in which case the default inset for this side for the platform will be used.
right The right inset. E.g. "10px" or "10mm" or "related". May be null in which case the default inset for this side for the platform will be used.
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
setInsets(net.miginfocom.layout.UnitValue[])
 
 	public final LC insets(String topString leftString bottomString right)
 	{
 		 = new UnitValue[] { // No setter to avoid copy again
 				ConstraintParser.parseUnitValue(topfalse),
 				ConstraintParser.parseUnitValue(lefttrue),
 				ConstraintParser.parseUnitValue(bottomfalse),
 				ConstraintParser.parseUnitValue(righttrue)};
 		return this;
 	}

Same functionality as setAlignX(ConstraintParser.parseUnitValueOrAlign(unitValue, true)) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
align The align keyword or for instance "100px". E.g "left", "right", "leading" or "trailing".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
setAlignX(net.miginfocom.layout.UnitValue)
 
 	public final LC alignX(String align)
 	{
 		setAlignX(ConstraintParser.parseUnitValueOrAlign(aligntruenull));
 		return this;
 	}

Same functionality as setAlignY(ConstraintParser.parseUnitValueOrAlign(align, false)) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
align The align keyword or for instance "100px". E.g "top" or "bottom".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
setAlignY(net.miginfocom.layout.UnitValue)
 
 	public final LC alignY(String align)
 	{
 		setAlignY(ConstraintParser.parseUnitValueOrAlign(alignfalsenull));
 		return this;
 	}

Sets both the alignX and alignY as the same time.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
ax The align keyword or for instance "100px". E.g "left", "right", "leading" or "trailing".
ay The align keyword or for instance "100px". E.g "top" or "bottom".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
alignX(java.lang.String)
alignY(java.lang.String)
 
 	public final LC align(String axString ay)
 	{
 		if (ax != null)
 			alignX(ax);
 
 		if (ay != null)
 			alignY(ay);
 
 		return this;
 	}

Same functionality as setGridGapX(ConstraintParser.parseBoundSize(boundsSize, true, true)) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
boundsSize The BoundSize of the gap. This is a minimum and/or preferred and/or maximum size. E.g. "50:100:200" or "100px".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
setGridGapX(net.miginfocom.layout.BoundSize)
 
 	public final LC gridGapX(String boundsSize)
 	{
 		setGridGapX(ConstraintParser.parseBoundSize(boundsSizetruetrue));
 		return this;
 	}

Same functionality as setGridGapY(ConstraintParser.parseBoundSize(boundsSize, true, false)) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
boundsSize The BoundSize of the gap. This is a minimum and/or preferred and/or maximum size. E.g. "50:100:200" or "100px".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
setGridGapY(net.miginfocom.layout.BoundSize)
 
 	public final LC gridGapY(String boundsSize)
 	{
 		setGridGapY(ConstraintParser.parseBoundSize(boundsSizetruefalse));
 		return this;
 	}

Sets both grid gaps at the same time. see gridGapX(java.lang.String) and gridGapY(java.lang.String).

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
gapx The BoundSize of the gap. This is a minimum and/or preferred and/or maximum size. E.g. "50:100:200" or "100px".
gapy The BoundSize of the gap. This is a minimum and/or preferred and/or maximum size. E.g. "50:100:200" or "100px".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
gridGapX(java.lang.String)
gridGapY(java.lang.String)
 
 	public final LC gridGap(String gapxString gapy)
 	{
 		if (gapx != null)
 			gridGapX(gapx);
 
 		if (gapy != null)
 			gridGapY(gapy);
 
 		return this;
 	}

Same functionality as setDebugMillis(int) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
repaintMillis The new debug repaint interval.
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
setDebugMillis(int)
 
 	public final LC debug(int repaintMillis)
 	{
 		setDebugMillis(repaintMillis);
 		return this;
 	}

Same functionality as setHideMode(int) only this method returns this for chaining multiple calls.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters:
mode The mode:
0 == Normal. Bounds will be calculated as if the component was visible.
1 == If hidden the size will be 0, 0 but the gaps remain.
2 == If hidden the size will be 0, 0 and gaps set to zero.
3 == If hidden the component will be disregarded completely and not take up a cell in the grid..
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
See also:
setHideMode(int)
 
 	public final LC hideMode(int mode)
 	{
 		setHideMode(mode);
 		return this;
 	}

The minimum width for the container. The value will override any value that is set on the container itself.

For a more thorough explanation of what this constraint does see the white paper or Cheat Sheet at www.migcontainers.com.

Parameters:
width The width expressed as a UnitValue. E.g. "100px" or "200mm".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC minWidth(String width)
 	{
 		setWidth(LayoutUtil.derive(getWidth(), ConstraintParser.parseUnitValue(widthtrue), nullnull));
 		return this;
 	}

The width for the container as a min and/or preferred and/or maximum width. The value will override any value that is set on the container itself.

For a more thorough explanation of what this constraint does see the white paper or Cheat Sheet at www.migcontainers.com.

Parameters:
width The width expressed as a BoundSize. E.g. "50:100px:200mm" or "100px".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC width(String width)
 	{
 		setWidth(ConstraintParser.parseBoundSize(widthfalsetrue));
 		return this;
 	}

The maximum width for the container. The value will override any value that is set on the container itself.

For a more thorough explanation of what this constraint does see the white paper or Cheat Sheet at www.migcontainers.com.

Parameters:
width The width expressed as a UnitValue. E.g. "100px" or "200mm".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC maxWidth(String width)
 	{
 		setWidth(LayoutUtil.derive(getWidth(), nullnull, ConstraintParser.parseUnitValue(widthtrue)));
 		return this;
 	}

The minimum height for the container. The value will override any value that is set on the container itself.

For a more thorough explanation of what this constraint does see the white paper or Cheat Sheet at www.migcontainers.com.

Parameters:
height The height expressed as a UnitValue. E.g. "100px" or "200mm".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC minHeight(String height)
 	{
 		setHeight(LayoutUtil.derive(getHeight(), ConstraintParser.parseUnitValue(heightfalse), nullnull));
 		return this;
 	}

The height for the container as a min and/or preferred and/or maximum height. The value will override any value that is set on the container itself.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcontainers.com.

Parameters:
height The height expressed as a BoundSize. E.g. "50:100px:200mm" or "100px".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
 
 	public final LC height(String height)
 	{
 		setHeight(ConstraintParser.parseBoundSize(heightfalsefalse));
 		return this;
 	}

The maximum height for the container. The value will override any value that is set on the container itself.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcontainers.com.

Parameters:
height The height expressed as a UnitValue. E.g. "100px" or "200mm".
Returns:
this so it is possible to chain calls. E.g. new LayoutConstraint().noGrid().gap().fill().
	public final LC maxHeight(String height)
		setHeight(LayoutUtil.derive(getHeight(), nullnull, ConstraintParser.parseUnitValue(heightfalse)));
		return this;
	// ************************************************
	// Persistence Delegate and Serializable combined.
	// ************************************************
		return LayoutUtil.getSerializedObject(this);
		LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(in));
	public void writeExternal(ObjectOutput outthrows IOException
		if (getClass() == LC.class)
			LayoutUtil.writeAsXML(outthis);
New to GrepCode? Check out our FAQ X