net.sourceforge.simplegamenet.util.proportionlayout
Class ProportionConstraints

java.lang.Object
  extended bynet.sourceforge.simplegamenet.util.proportionlayout.ProportionConstraints
All Implemented Interfaces:
Serializable

public class ProportionConstraints
extends Object
implements Serializable

The ProportionConstraints class specifies constraints for components that are laid out using the ProportionLayout class.

Author:
Geoffrey and Jeroen
See Also:
Serialized Form

Field Summary
static int BOTH
          Resize the component both horizontally and vertically.
static int CENTER
          Put the component in the center of its display area.
static int EAST
          Put the component on the right side of its display area, centered vertically.
static int HORIZONTAL
          Resize the component horizontally but not vertically.
static int NONE
          Do not resize the component.
static int NORTH
          Put the component at the top of its display area, centered horizontally.
static int NORTH_EAST
          Put the component at the top-right corner of its display area.
static int NORTH_WEST
          Put the component at the top-left corner of its display area.
static int SOUTH
          Put the component at the bottom of its display area, centered horizontally.
static int SOUTH_EAST
          Put the component at the bottom-right corner of its display area.
static int SOUTH_WEST
          Put the component at the bottom-left corner of its display area.
static int VERTICAL
          Resize the component vertically but not horizontally.
static int WEST
          Put the component on the left side of its display area, centered vertically.
 
Constructor Summary
ProportionConstraints(int gridX, int gridY)
          Creates a new instance of ProportionConstraints
ProportionConstraints(int gridX, int gridY, int gridWidth, int gridHeight)
          Creates a new instance of ProportionConstraints
ProportionConstraints(int gridX, int gridY, int gridWidth, int gridHeight, int extendGridX, int extendGridY)
          Creates a new instance of ProportionConstraints
ProportionConstraints(int gridX, int gridY, int gridWidth, int gridHeight, int extendGridX, int extendGridY, int anchor, int fill)
          Creates a new instance of ProportionConstraints
ProportionConstraints(int gridX, int gridY, int gridWidth, int gridHeight, int extendGridX, int extendGridY, int anchor, int fill, Insets insets, int iPadX, int iPadY)
          Creates a new instance of ProportionConstraints
ProportionConstraints(int gridX, int gridY, int gridWidth, int gridHeight, int extendGridX, int extendGridY, int anchor, int fill, int insetNorth, int insetEast, int insetSouth, int insetWest, int iPadX, int iPadY)
          Creates a new instance of ProportionConstraints
 
Method Summary
 net.sourceforge.simplegamenet.util.proportionlayout.ProportionLinePart getColumnLinePart(Component component, int linesSize)
          Represents the x-dimension of a specific cell made with ProportionConstraints.
 net.sourceforge.simplegamenet.util.proportionlayout.ProportionLinePart getRowLinePart(Component component, int linesSize)
          Represents the y-dimension of a specific cell made with ProportionConstraints.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Do not resize the component.

See Also:
Constant Field Values

BOTH

public static final int BOTH
Resize the component both horizontally and vertically.

See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
Resize the component horizontally but not vertically.

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
Resize the component vertically but not horizontally.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Put the component in the center of its display area.

See Also:
Constant Field Values

NORTH

public static final int NORTH
Put the component at the top of its display area, centered horizontally.

See Also:
Constant Field Values

NORTH_EAST

public static final int NORTH_EAST
Put the component at the top-right corner of its display area.

See Also:
Constant Field Values

EAST

public static final int EAST
Put the component on the right side of its display area, centered vertically.

See Also:
Constant Field Values

SOUTH_EAST

public static final int SOUTH_EAST
Put the component at the bottom-right corner of its display area.

See Also:
Constant Field Values

SOUTH

public static final int SOUTH
Put the component at the bottom of its display area, centered horizontally.

See Also:
Constant Field Values

SOUTH_WEST

public static final int SOUTH_WEST
Put the component at the bottom-left corner of its display area.

See Also:
Constant Field Values

WEST

public static final int WEST
Put the component on the left side of its display area, centered vertically.

See Also:
Constant Field Values

NORTH_WEST

public static final int NORTH_WEST
Put the component at the top-left corner of its display area.

See Also:
Constant Field Values
Constructor Detail

ProportionConstraints

public ProportionConstraints(int gridX,
                             int gridY)
                      throws IllegalArgumentException
Creates a new instance of ProportionConstraints

Parameters:
gridX - specifies the column containing the left edge of the component's display area. The first column has gridX = 0.
gridY - specifies the row containing the upper edge of the component's display area. The first row has gridY = 0.
Throws:
IllegalArgumentException - if gridX or GridY < 0.

ProportionConstraints

public ProportionConstraints(int gridX,
                             int gridY,
                             int gridWidth,
                             int gridHeight)
                      throws IllegalArgumentException
Creates a new instance of ProportionConstraints

Parameters:
gridX - specifies the column containing the left edge of the component's display area. The first column has gridX = 0.
gridY - specifies the row containing the upper edge of the component's display area. The first row has gridY = 0.
gridWidth - Specifies the width of the cell (gridX,gridY).
gridHeight - Specifies the height of the cell (gridX, gridY).
Throws:
IllegalArgumentException - if gridX or GridY < 0.

ProportionConstraints

public ProportionConstraints(int gridX,
                             int gridY,
                             int gridWidth,
                             int gridHeight,
                             int extendGridX,
                             int extendGridY)
                      throws IllegalArgumentException
Creates a new instance of ProportionConstraints

Parameters:
gridX - specifies the column containing the left edge of the component's display area. The first column has gridX = 0.
gridY - specifies the row containing the left edge of the component's display area. The first row has gridY = 0.
gridWidth - specifies the width of the cell (gridX,gridY).
gridHeight - specifies the height of the cell (gridX,gridY).
extendGridX - specifies the number of cells to extend the cell (gridX, gridY) horizontally when a component needs more space then the cells combined.
extendGridY - specifies the number of cells to extend the cell (gridX, gridY) vertically when a component needs more space then the cells combined.
Throws:
IllegalArgumentException - if gridX or GridY < 0.

ProportionConstraints

public ProportionConstraints(int gridX,
                             int gridY,
                             int gridWidth,
                             int gridHeight,
                             int extendGridX,
                             int extendGridY,
                             int anchor,
                             int fill)
                      throws IllegalArgumentException
Creates a new instance of ProportionConstraints

Parameters:
gridX - specifies the column containing the left edge of the component's display area. The first column has gridX = 0.
gridY - specifies the row containing the left edge of the component's display area. The first row has gridY = 0.
gridWidth - specifies the width of the cell (gridX,gridY).
gridHeight - specifies the height of the cell (gridX,gridY).
extendGridX - specifies the number of cells to extend the cell (gridX, gridY) horizontally when a component needs more space then the cells combined.
extendGridY - specifies the number of cells to extend the cell (gridX, gridY) vertically when a component needs more space then the cells combined.
anchor - this field is used when the component is smaller than its display area. It determines where, within the display area, to place the component. The possible values are: CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST and NORTHWEST. The default value is CENTER.
fill - this field is used when the component's display area is larger than the component's requested size. It determines whether to resize the component, and if so, how.

The following values are valid for fill:

The default value is NONE.

Throws:
IllegalArgumentException - if gridX or GridY < 0.

ProportionConstraints

public ProportionConstraints(int gridX,
                             int gridY,
                             int gridWidth,
                             int gridHeight,
                             int extendGridX,
                             int extendGridY,
                             int anchor,
                             int fill,
                             Insets insets,
                             int iPadX,
                             int iPadY)
                      throws IllegalArgumentException
Creates a new instance of ProportionConstraints

Parameters:
gridX - specifies the column containing the left edge of the component's display area. The first column has gridX = 0.
gridY - specifies the row containing the left edge of the component's display area. The first row has gridY = 0.
gridWidth - specifies the width of the cell (gridX,gridY).
gridHeight - specifies the height of the cell (gridX,gridY).
extendGridX - specifies the number of cells to extend the cell (gridX, gridY) horizontally when a component needs more space then the cells combined.
extendGridY - specifies the number of cells to extend the cell (gridX, gridY) vertically when a component needs more space then the cells combined.
anchor - this field is used when the component is smaller than its display area. It determines where, within the display area, to place the component. The possible values are: CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, and NORTHWEST. The default value is CENTER.
fill - this field is used when the component's display area is larger than the component's requested size. It determines whether to resize the component, and if so, how.

The following values are valid for fill:

The default value is NONE.

insets - this field specifies the external padding of the component, the minimum amount of space between the component and the edges of its display area.
iPadX - this field specifies the internal padding of the component, how much space to add to the minimum width of the component. The width of the component is at least its minimum width plus (ipadx * 2) pixels.
iPadY - this field specifies the internal padding, that is, how much space to add to the minimum height of the component. The height of the component is at least its minimum height plus (ipady * 2) pixels.
Throws:
IllegalArgumentException - if gridX or GridY < 0.

ProportionConstraints

public ProportionConstraints(int gridX,
                             int gridY,
                             int gridWidth,
                             int gridHeight,
                             int extendGridX,
                             int extendGridY,
                             int anchor,
                             int fill,
                             int insetNorth,
                             int insetEast,
                             int insetSouth,
                             int insetWest,
                             int iPadX,
                             int iPadY)
                      throws IllegalArgumentException
Creates a new instance of ProportionConstraints

Parameters:
gridX - specifies the column containing the left edge of the component's display area. The first column has gridX = 0.
gridY - specifies the row containing the left edge of the component's display area. The first row has gridY = 0.
gridWidth - specifies the width of the cell (gridX,gridY).
gridHeight - specifies the height of the cell (gridX,gridY).
extendGridX - specifies the number of cells to extend the cell (gridX, gridY) horizontally when a component needs more space then the cells combined.
extendGridY - specifies the number of cells to extend the cell (gridX, gridY) vertically when a component needs more space then the cells combined.
anchor - this field is used when the component is smaller than its display area. It determines where, within the display area, to place the component. The possible values are: CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, and NORTHWEST. The default value is CENTER.
fill - this field is used when the component's display area is larger than the component's requested size. It determines whether to resize the component, and if so, how.

The following values are valid for fill:

The default value is NONE.

insetNorth - This field specifies the external padding of the component, the minimum amount of space between the component and the northern edge of its display area.
insetEast - This field specifies the external padding of the component, the minimum amount of space between the component and the eastern edge of its display area.
insetSouth - This field specifies the external padding of the component, the minimum amount of space between the component and the southern edge of its display area.
insetWest - This field specifies the external padding of the component, the minimum amount of space between the component and the western edge of its display area.
iPadX - This field specifies the internal padding of the component, how much space to add to the minimum width of the component. The width of the component is at least its minimum width plus (ipadx * 2) pixels.
iPadY - This field specifies the internal padding, that is, how much space to add to the minimum height of the component. The height of the component is at least its minimum height plus (ipady * 2) pixels.
Throws:
IllegalArgumentException - if gridX or GridY < 0.
Method Detail

getColumnLinePart

public net.sourceforge.simplegamenet.util.proportionlayout.ProportionLinePart getColumnLinePart(Component component,
                                                                                                int linesSize)
                                                                                         throws IndexOutOfBoundsException
Represents the x-dimension of a specific cell made with ProportionConstraints.

Parameters:
component - specifies the component to which this column's ProportionLinePart belongs.
linesSize - specifies the number of columns in the grid made with addColumn.
Returns:
the linepart of this specific component based on it's constraints.
Throws:
IndexOutOfBoundsException - if gridX + gridWidth > the number of columns that are added to this grid addColumn.

getRowLinePart

public net.sourceforge.simplegamenet.util.proportionlayout.ProportionLinePart getRowLinePart(Component component,
                                                                                             int linesSize)
                                                                                      throws IndexOutOfBoundsException
Represents the y-dimension of a specific cell made with ProportionConstraints.

Parameters:
component - specifies the component to which this row's ProportionLinePart belongs.
linesSize - specifies the number of rows in the grid made with addRow.
Returns:
the linepart of this specific component based on it's constraints.
Throws:
IndexOutOfBoundsException - if gridY + gridHeigth > the number of rows that are added to this grid with addRow.


Copyright © 2003-2004 The 3 Belgians. All Rights Reserved.