|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pagelayout.EasyCell
public class EasyCell
This class contains static methods that provide convenient ways
to call the various constructors and createCellGrid
methods. These methods can be used be adding the
import static pagelayout.EasyCell.*
statements to
the set of import statements of the calling class.
The various constants for justfication in the class
Cell
are repeated here with lower case counterparts,
with NO_ALIGNMENT
replaced by none
.
Of special interest are the methods
row
,
row
,
column
,
column
,
grid
,
which can be called with arbitrary
combinations of objects of the type Component
as well of the type Cell
(rows, columns, grids, gaps, and component cells). Note
that the type checking in these methods is performed at run time,
and so they should be used with care.
The classes Example2
,
Example3
,
Example4
,
Example5
,
Example10
,
illustrate the use of these methods.
An alternative to using these methods is to use the corresponding
methods
row
,
row
,
column
,
column
,
grid
,
that use Cell
objects, and wrap components in a cell
by using the
cell
method of this class. This will ensure
that type checking as perfromed by the compiler.
For the methods
grid
and
grid
, that can be used to create grids, the
followin methods are useful:
span
or
hspan
should be used to specify that a cell/component
span more than one column in a row,vspan
should be used to specify that a cell/component
span more than one row in a column,skip
should be used to specify an empty column in
a row of the grid, and eol
should be used to specify the
termination of a row in the grid and the beginning of the next. As an example of all these methods, consider the following scehmatic layout:
With c1, c2,
etc. representing the various components,
grid may be laid out by the following code:
CellGrid cellgrid=grid(c1,c2,skip(),eol(), vspan(),row(c3,c4),span(),eol(), vspan(),c5,span(),span(),eol(), c6,c7,c8);
Field Summary | |
---|---|
static int |
baseline
Constant for specifying Baseline alignment (for rows). |
static int |
bottom
Constant for specifying bottom justified vertical alignment. |
static int |
center
Constant for specifying center justified alignment. |
static int |
justified
Constant for specifying fully justified alignment. |
static int |
left
Constant for specifying left justified horizontal alignment. |
static int |
none
Constant for specifying no alignment. |
static int |
right
Constant for specifying right justified horizontal alignment. |
static int |
top
Constant for specifying top justified vertical alignment. |
Constructor Summary | |
---|---|
EasyCell()
|
Method Summary | |
---|---|
static Cell |
cell(java.awt.Component c)
Convenienence cover method for ComponentCell constructor. |
static Column |
column(Cell... c)
Convenienence cover method for the Column constructor. |
static Column |
column(java.awt.Component... c)
Convenienence cover method for the Column constructor. |
static Column |
column(int hjust,
int vjust,
Cell... c)
Convenienence cover method for the Column constructor. |
static Column |
column(int hjust,
int vjust,
java.awt.Component... c)
Convenienence cover method for the Column constructor. |
static Column |
column(int hjust,
int vjust,
java.lang.Object... objects)
Create a column from cells or components. |
static Column |
column(java.lang.Object... objects)
Create a column from cells or components. |
static void |
coverPanel(javax.swing.JPanel panel,
javax.swing.JComponent c)
Effectively replaces a panel by the given component when the panel is placed in a container. |
static Cell |
eol()
Returns a cell object that must be used to separate the rows in a grid when the grid or
grid
method is used. |
static CellGrid |
grid(Cell... cells)
Creates a grid from a list of cells. |
static CellGrid |
grid(java.lang.Object... objects)
Creates a grid from a list of cells or components. |
static Cell |
hgap(int min)
Convenienence cover method for the Gap constructor, with
the second argument set to true, to return a horizontal gap. |
static Cell |
hgap(int min,
int pref,
int max)
Convenienence cover method for the Gap constructor, with
the second argument set to true, to return a horizontal gap. |
static Cell |
hspan()
Returns a cell object that must be used to specify that the previous cell in the current row span the current cell as well when grid or
grid
method is used. |
static Row |
row(Cell... c)
Convenienence cover method for the Row constructor. |
static Row |
row(java.awt.Component... c)
Convenienence cover method for the Row constructor. |
static Row |
row(int hjust,
int vjust,
Cell... c)
Convenienence cover method for the Row constructor. |
static Row |
row(int hjust,
int vjust,
java.awt.Component... c)
Convenienence cover method for the Row constructor. |
static Row |
row(int hjust,
int vjust,
java.lang.Object... objects)
Create a row from cells or components. |
static Row |
row(java.lang.Object... objects)
Create a row from cells or components. |
static void |
setDimensions(java.awt.Component c,
java.awt.Dimension[] dd)
|
static void |
setDimensions(javax.swing.JComponent c,
boolean useRules,
int minW,
int minH,
int maxW,
int maxH,
int prefW,
int prefH)
|
static void |
setDimensions(javax.swing.JComponent c,
int minW,
int minH,
int maxW,
int maxH,
int prefW,
int prefH)
|
static void |
setDimensions(javax.swing.JTextField c,
int col,
int minW,
int minH,
int maxW,
int maxH,
int prefW,
int prefH)
|
static void |
setTADimensions(javax.swing.JTextArea c,
int rows,
int col,
int minW,
int minH,
int maxW,
int maxH,
int prefW,
int prefH)
|
static Cell |
skip()
Returns a cell object that must be used to specify that the cell in the current column remain empty when the grid or
grid
method is used. |
static Cell |
span()
Returns a cell object that must be used to specify that the previous cell in the current row span the current cell as well when grid or
grid
method is used. |
static Cell |
vgap(int min)
Convenienence cover method for the Gap constructor. |
static Cell |
vgap(int min,
int pref,
int max)
Convenienence cover method for the Gap constructor. |
static Cell |
vspan()
Returns a cell object that must be used to specify that the cell in the current column of the previous row span the current cell as well when grid or
grid
method is used. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int none
public static final int top
public static final int center
public static final int bottom
public static final int left
public static final int right
public static final int justified
public static final int baseline
Constructor Detail |
---|
public EasyCell()
Method Detail |
---|
public static Cell cell(java.awt.Component c)
ComponentCell
constructor.
public static Row row(int hjust, int vjust, java.awt.Component... c)
Row
constructor.
public static Column column(int hjust, int vjust, java.awt.Component... c)
Column
constructor.
public static Row row(java.awt.Component... c)
Row
constructor.
public static Column column(java.awt.Component... c)
Column
constructor.
public static Row row(int hjust, int vjust, Cell... c)
Row
constructor.
public static Column column(int hjust, int vjust, Cell... c)
Column
constructor.
public static Row row(Cell... c)
Row
constructor.
public static Column column(Cell... c)
Column
constructor.
public static Cell eol()
grid
or
grid
method is used.
public static Row row(java.lang.Object... objects)
IllegalArgument
exception if any other type of object
is used as the input.
objects
- List of cells or components
public static Row row(int hjust, int vjust, java.lang.Object... objects)
IllegalArgument
exception if any other type of object
is used as the input.
hjust
- horizontal justification for the rowvjust
- vertical justification for the rowobjects
- List of cells or components
public static Column column(java.lang.Object... objects)
IllegalArgument
exception if any other type of object
is used as the input.
objects
- List of cells or components
public static Column column(int hjust, int vjust, java.lang.Object... objects)
IllegalArgument
exception if any other type of object
is used as the input.
hjust
- horizontal justification for the rowvjust
- vertical justification for the rowobjects
- List of cells or components
public static Cell span()
grid
or
grid
method is used.
public static Cell hspan()
grid
or
grid
method is used.
public static Cell vspan()
grid
or
grid
method is used.
public static Cell vgap(int min)
Gap
constructor.
public static Cell vgap(int min, int pref, int max)
Gap
constructor.
public static Cell hgap(int min)
Gap
constructor, with
the second argument set to true, to return a horizontal gap.
public static Cell hgap(int min, int pref, int max)
Gap
constructor, with
the second argument set to true, to return a horizontal gap.
public static CellGrid grid(Cell... cells)
cells
- the list of cells in the grid, with each row separated
by the cell returned by the
eol
method of this class.
public static CellGrid grid(java.lang.Object... objects)
objects
- the list of cells or components
in the grid, with each row separated
by the cell returned by the
eol
method of this class.
public static Cell skip()
grid
or
grid
method is used.
public static void setDimensions(java.awt.Component c, java.awt.Dimension[] dd)
public static void setDimensions(javax.swing.JComponent c, int minW, int minH, int maxW, int maxH, int prefW, int prefH)
public static void setDimensions(javax.swing.JComponent c, boolean useRules, int minW, int minH, int maxW, int maxH, int prefW, int prefH)
public static void setDimensions(javax.swing.JTextField c, int col, int minW, int minH, int maxW, int maxH, int prefW, int prefH)
public static void setTADimensions(javax.swing.JTextArea c, int rows, int col, int minW, int minH, int maxW, int maxH, int prefW, int prefH)
public static void coverPanel(javax.swing.JPanel panel, javax.swing.JComponent c)
panel
- The panel to be covered.c
- The component that should cover the panel.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |