|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jwo.utils.gui.SGLayout
public class SGLayout
Creates simple scalded grid layout with multiple columns and rows. See JavaWorld Tips, 129.
Field Summary | |
---|---|
static int |
BOTTOM
Indicates bottom alignment of a cell. |
protected int |
bottomBorder
|
static int |
CENTER
Indicates centred alignment of a cell. |
protected int |
cols
|
protected double[] |
columnScale
|
protected int[] |
columnSizes
|
static int |
FILL
Indicates cell should fill available space. |
protected int |
hAlignment
|
protected int[][] |
hAlignments
|
protected int |
hgap
|
static int |
LEFT
Indicates left alignment of a cell. |
protected int |
leftBorder
|
protected int |
minH
|
protected int |
minW
|
static int |
RIGHT
Indicates right alignment of a cell. |
protected int |
rightBorder
|
protected int |
rows
|
protected double[] |
rowScale
|
protected int[] |
rowSizes
|
static int |
TOP
Indicates top alignment of a cell. |
protected int |
topBorder
|
protected int |
vAlignment
|
protected int[][] |
vAlignments
|
protected int |
vgap
|
Constructor Summary | |
---|---|
SGLayout()
Creates a default (2 x 2) layout. |
|
SGLayout(int rows,
int cols)
Creates a layout with the specified number of rows and columns. |
|
SGLayout(int rows,
int cols,
int hgap,
int vgap)
Creates a layout with the specified number of rows and columns and specified gaps. |
|
SGLayout(int rows,
int cols,
int hAlignment,
int vAlignment,
int hgap,
int vgap)
Creates a layout with the specified number of rows and columns, specified gaps and alignment properties. |
Method Summary | |
---|---|
void |
addLayoutComponent(String name,
Component comp)
Adds a component to the layout, but does nothing in this case. |
protected void |
allocateMaxSizes(Container parent)
Update the maximum sizes for each of the grid cells using the specified scale values for rows and columns. |
void |
layoutContainer(Container parent)
Lays out the specified container using this layout within the calculated grids. |
Dimension |
minimumLayoutSize(Container parent)
Determines the minimum size of the container argument using this grid layout. |
Dimension |
preferredLayoutSize(Container parent)
Determines the preferred size of the container argument using this grid layout. |
void |
removeLayoutComponent(Component comp)
Adds a component to the layout, but does nothing in this case. |
void |
setAlignment(int row,
int col,
int hAlignment,
int vAlignment)
Set up alignment for a specific cell. |
void |
setColumnAlignment(int col,
int hAlignment,
int vAlignment)
Set up alignment for a specific column. |
void |
setColumnScale(int index,
double prop)
Sets up scale value for a specific column. |
void |
setMargins(int topBorder,
int leftBorder,
int bottomBorder,
int rightBorder)
Sets up the margins for the whole layout. |
void |
setRowAlignment(int row,
int hAlignment,
int vAlignment)
Set up alignment for a specific row. |
void |
setRowScale(int index,
double prop)
Sets up scale value for a specific row. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int FILL
public static final int TOP
public static final int BOTTOM
protected int rows
protected int cols
protected int vgap
protected int hgap
protected int topBorder
protected int leftBorder
protected int bottomBorder
protected int rightBorder
protected int minW
protected int minH
protected double[] rowScale
protected double[] columnScale
protected int hAlignment
protected int vAlignment
protected int[][] hAlignments
protected int[][] vAlignments
protected int[] rowSizes
protected int[] columnSizes
Constructor Detail |
---|
public SGLayout()
public SGLayout(int rows, int cols)
rows
- Number of rows.cols
- Number of columns.public SGLayout(int rows, int cols, int hgap, int vgap)
rows
- Number of rows.cols
- Number of columns.hgap
- The horizontal gap, in pixels.vgap
- The vertical gap, in pixels.public SGLayout(int rows, int cols, int hAlignment, int vAlignment, int hgap, int vgap)
rows
- Number of rows.cols
- Number of columns.hAlignment
- The X-alignment (LEFT, RIGHT, CENTER or FILL).vAlignment
- the Y-alignment (TOP, BOTTOM, CENTER or FILL).hgap
- The horizontal gap, in pixels.vgap
- The vertical gap, in pixels.Method Detail |
---|
public void setMargins(int topBorder, int leftBorder, int bottomBorder, int rightBorder)
topBorder
- The top border (in pixels).leftBorder
- The left border (in pixels).bottomBorder
- The bottom border (in pixels).rightBorder
- The right border (in pixels).public void setRowScale(int index, double prop)
index
- The row number to scale.prop
- The scale value for the row.public void setColumnScale(int index, double prop)
index
- The column number to scale.prop
- The scale value for the column.public void setAlignment(int row, int col, int hAlignment, int vAlignment)
row
- The row value of the cell to align.col
- The column value of the cell to align.hAlignment
- The X-alignment (LEFT, RIGHT, CENTER or FILL).vAlignment
- the Y-alignment (TOP, BOTTOM, CENTER or FILL).public void setRowAlignment(int row, int hAlignment, int vAlignment)
row
- The row to align.hAlignment
- The X-alignment (LEFT, RIGHT, CENTER or FILL).vAlignment
- the Y-alignment (TOP, BOTTOM, CENTER or FILL).public void setColumnAlignment(int col, int hAlignment, int vAlignment)
col
- The column to align.hAlignment
- The X-alignment (LEFT, RIGHT, CENTER or FILL).vAlignment
- the Y-alignment (TOP, BOTTOM, CENTER or FILL).public void addLayoutComponent(String name, Component comp)
addLayoutComponent
in interface LayoutManager
name
- Ignored in this case.comp
- Ignored in this case.public void removeLayoutComponent(Component comp)
removeLayoutComponent
in interface LayoutManager
comp
- Ignored in this case.public Dimension preferredLayoutSize(Container parent)
preferredLayoutSize
in interface LayoutManager
parent
- The container in which to do the layout.
public Dimension minimumLayoutSize(Container parent)
minimumLayoutSize
in interface LayoutManager
parent
- The container in which to do the layout.
public void layoutContainer(Container parent)
layoutContainer
in interface LayoutManager
parent
- the container to be laid out.protected void allocateMaxSizes(Container parent)
parent
- the container to be laid out.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |