Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.tigris.swidgets.FlexiGridLayout
public class FlexiGridLayout
extends java.lang.Object
implements LayoutManager, java.io.Serializable
Field Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
Constructor Summary | |
| |
| |
| |
| |
| |
| |
|
Method Summary | |
void |
|
protected Dimension |
|
protected int[] | |
int | |
protected int |
|
protected int |
|
int |
|
protected int | |
protected int | |
protected int[] | |
int |
|
int |
|
void |
|
Dimension |
|
protected void |
|
Dimension |
|
void |
|
protected void |
|
void |
|
void |
|
protected void |
|
protected void |
|
protected void |
|
void |
|
void |
|
public static final int BOTH
Resize all child components to fit their cell both horizontally and vertically.
- Field Value:
- 1
public static final int CENTER
Put the component in the center of its display area.
- Field Value:
- 10
public static final int EAST
Put the component on the right side of its display area, centered vertically.
- Field Value:
- 13
public static final int FITPARENT
Size all cells as the same width and height to fit the parent component. A possible value for the cellSizing parameter of the constructor in order to size cells so that each has the same height and width and are sized to fit their parent. This emulates the sizing done by a standard GridLayout.
- Field Value:
- 22
public static final int HORIZONTAL
Resize all child components to fit their cell horizontally but not vertically.
- Field Value:
- 2
public static final int MAXPREFERRED
Size all cells as the largest prefered width and height component. A possible value for the cellSizing parameter of the constructor in order to size cells so that each have the same width and height. The width is the largest prefered width and the height is the largest prefered height of all these child components.
- Field Value:
- 20
public static final int NONE
Do not resize the child components.
- Field Value:
- 0
public static final int NORTH
Put the component at the top of its display area, centered horizontally.
- Field Value:
- 11
public static final int NORTHEAST
Put the component at the top-right corner of its display area.
- Field Value:
- 12
public static final int NORTHWEST
Put each component in the top-left corner of its display area.
- Field Value:
- 18
public static final int ROWCOLPREFERRED
Size all cells so that all in the same row are the same height and all in the same column are the same width. A possible value for the cellSizing parameter of the constructor. The width is the largest prefered width of all components in the same column and the height is the largest prefered height of all components in the same row.
- Field Value:
- 21
public static final int SOUTH
Put the component at the bottom of its display area, centered horizontally.
- Field Value:
- 15
public static final int SOUTHEAST
Put the component at the bottom-right corner of its display area.
- Field Value:
- 14
public static final int SOUTHWEST
Put the component at the bottom-left corner of its display area.
- Field Value:
- 16
public static final int VERTICAL
Resize all child components to fit their cell vertically but not horizontally.
- Field Value:
- 3
public static final int WEST
Put the component on the left side of its display area, centered vertically.
- Field Value:
- 17
public FlexiGridLayout()
Construct a new GridLayout2 with a default of one column per component, in a single row.
public FlexiGridLayout(int r, int c)
Construct a new GridLayout2 with the specified number of rows and columns.
- Parameters:
public FlexiGridLayout(int rows, int cols, int cellSizing)
Construct a new GridLayout2 with the specified number of rows and columns and cell sizing scheme.
- Parameters:
rows
- the number of rows in the layoutcols
- the number of columns in the layoutcellSizing
- the required cell sizing scheme
public FlexiGridLayout(int rows, int cols, int hgap, int vgap)
Construct a new GridLayout2 with the specified number of rows and columns and cell spacing.
- Parameters:
rows
- the number of rows in the layoutcols
- the number of columns in the layouthgap
- the horizontal gap between cellsvgap
- the vertical gap between cells
public FlexiGridLayout(int rows, int cols, int hgap, int vgap, int cellSizing)
Construct a new GridLayout2 with the specified number of rows and columns, cell spacing and cell sizing scheme.
- Parameters:
rows
- the number of rows in the layoutcols
- the number of columns in the layouthgap
- the horizontal gap between cellsvgap
- the vertical gap between cellscellSizing
- the required cell sizing scheme
public FlexiGridLayout(int rows, int cols, int hgap, int vgap, int cellSizing, int fill)
Construct a new GridLayout2 with the specified number of rows and columns, cell spacing, cell sizing scheme and filling scheme.
- Parameters:
rows
- the number of rows in the layoutcols
- the number of columns in the layouthgap
- the horizontal gap between cellsvgap
- the vertical gap between cellscellSizing
- the required cell sizing schemefill
- the required cell filling scheme
public FlexiGridLayout(int rows, int cols, int hgap, int vgap, int cellSizing, int fill, int anchor)
Construct a new GridLayout2 with the specified number of rows and columns, cell spacing, cell sizing scheme and component sizing and anchoring scheme.
- Parameters:
rows
- the number of rows in the layoutcols
- the number of columns in the layouthgap
- the horizontal gap between cellsvgap
- the vertical gap between cellscellSizing
- the required cell sizing schemefill
- the required cell filling schemeanchor
- the required anchoring of a child component within its cell
public void addLayoutComponent(String name, Component comp)
Adds the specified component with the specified name to the layout. This is included to satisfy the LayoutManager interface but is not actually used in this layout implementation.
- Parameters:
name
- the name of the componentcomp
- the component to be added
protected Dimension calculateSizes(Container parent, colWidth[] , rowHeight[] , int actualRows, int actualCols, int largestWidth, int largestHeight)
protected int[] getColWidth()
- Returns:
- Returns the colWidth.
public int getColumns()
protected int getComponentCellHeight(int row)
protected int getComponentCellWidth(int col)
public int getHgap()
protected int getLargestHeight()
- Returns:
- Returns the largestHeight.
protected int getLargestWidth()
- Returns:
- Returns the largestWidth.
protected int[] getRowHeight()
- Returns:
- Returns the rowHeight.
public int getRows()
public int getVgap()
public void layoutContainer(Container parent)
- See Also:
java.awt.LayoutManager.layoutContainer(java.awt.Container)
public Dimension minimumLayoutSize(Container parent)
Required by LayoutManager.
- See Also:
java.awt.LayoutManager.minimumLayoutSize(java.awt.Container)
protected void positionComponentInCell(Component comp, int x, int y, int cellWidth, int cellHeight)
public Dimension preferredLayoutSize(Container parent)
Determines the preferred size of the container argument using this grid layout. The preferred size of a grid layout is dependant on the cellSizing scheme. MAXPREFERRED and FITPARENT use the same formula to calculate prefered size. The prefered width using MAXPREFERRED or FITPARENT is the largest preferred width of any of the widths in the container times the number of columns, plus the horizontal padding times the number of columns plus one, plus the left and right insets of the target container. The preferred height using MAXPREFERRED or FITPARENT is the largest preferred height of any of the heights in the container times the number of rows, plus the vertical padding times the number of rows plus one, plus the top and bottom insets of the target container. The prefered width using ROWCOLPREFERRED is the largest preferred is the sum of the widths of of all columns, plus the horizontal padding times the number of columns plus one, plus the left and right insets of the target container. The prefered height using ROWCOLPREFERRED is the largest preferred is the sum of the heights of of all columns, plus the horizontal padding times the number of columns plus one, plus the left and right insets of the target container.
- Parameters:
parent
- the container to be laid out
- Returns:
- the preferred dimensions to lay out the subcomponents of the specified container
public void removeLayoutComponent(Component comp)
Removes the specified component with the specified name from the layout. This is included to satisfy the LayoutManager interface but is not actually used in this layout implementation.
- Parameters:
protected void setColWidth(int[] cw)
- Parameters:
cw
- The colWidth to set.
public void setCols(int cols)
public void setHgap(int hgap)
protected void setLargestHeight(int lh)
- Parameters:
lh
- The largestHeight to set.
protected void setLargestWidth(int lw)
- Parameters:
lw
- The largestWidth to set.
protected void setRowHeight(int[] rh)
- Parameters:
rh
- The rowHeight to set.
public void setRows(int rows)
public void setVgap(int vgap)