|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.zfqjava.swing.CellLayout
CellLayout provides a cell layout.
Use JComponent.setAlignmentX and JComponent.setAlignmentY
to control the component alignment in specified cell.
Use FillMode to control the component fill mode.
Use CellLayout.Constraints to control the component cell location, and cell span.
| Inner Class Summary | |
static class |
CellLayout.Constraints
The CellLayout Constraints. |
| Constructor Summary | |
CellLayout(int row,
int col)
Constructs a CellLayout use the specified row and column. |
|
CellLayout(int row,
int col,
int hgap,
int vgap)
Constructs a CellLayout use the specified row and column and
default horizontal gap and vertical gap. |
|
| Method Summary | |
void |
addLayoutComponent(java.awt.Component comp,
java.lang.Object constraints)
Adds the specified component to the layout, using the specified constraint object. |
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
If the layout manager uses a per-component string, adds the component comp to the layout,
associating it
with the string specified by name. |
int |
getColumns()
Returns the number of columns in this layout. |
double |
getColumnWeight(int column)
Returns the weight at the specify column. |
int |
getHgap(int index)
Returns the horizontal gap at the specified index. |
float |
getLayoutAlignmentX(java.awt.Container parent)
Returns the alignment along the x axis. |
float |
getLayoutAlignmentY(java.awt.Container parent)
Returns the alignment along the y axis. |
int |
getRows()
Returns the number of rows in this layout. |
double |
getRowWeight(int row)
Returns the weight at the specify row. |
int |
getVgap(int index)
Returns the vertical gap at the specified index. |
void |
invalidateLayout(java.awt.Container parent)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. |
void |
layoutContainer(java.awt.Container parent)
Lays out the specified container. |
java.awt.Dimension |
maximumLayoutSize(java.awt.Container parent)
Calculates the maximum size dimensions for the specified container, given the components it contains. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container parent)
Calculates the minimum size dimensions for the specified container, given the components it contains. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container parent)
Calculates the preferred size dimensions for the specified container, given the components it contains. |
void |
removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout. |
void |
setColumns(int cols)
Sets the number of columns in this layout to the spefified value. |
void |
setColumnWeight(int column,
double weight)
Sets the weight at the specify column. |
void |
setHgap(int index,
int gap)
Sets the horizontal gap at the specified index. |
void |
setRows(int rows)
Sets the number of rows in this layout to the specified value. |
void |
setRowWeight(int row,
double weight)
Sets the weight at the specify row. |
void |
setVgap(int index,
int gap)
Sets the vertical gap at the specified index. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CellLayout(int row,
int col)
CellLayout use the specified row and column.row - the row numbercol - the column number
public CellLayout(int row,
int col,
int hgap,
int vgap)
CellLayout use the specified row and column and
default horizontal gap and vertical gap.row - the row numbercol - the column numberhgap - the default horizontal gapvgap - the default vertical gap| Method Detail |
public int getRows()
public void setRows(int rows)
rows - the number of rows in this layoutpublic int getColumns()
public void setColumns(int cols)
cols - the number of columns in this layout
public void setRowWeight(int row,
double weight)
row - the specify rowweight - the weight valuejava.lang.IndexOutOfBoundsException - if the specify row < 0 || > getRows()-1public double getRowWeight(int row)
row - the specify rowjava.lang.IndexOutOfBoundsException - if the specify row < 0 || > getRows()-1
public void setColumnWeight(int column,
double weight)
column - the specify columnweight - the weight valuejava.lang.IndexOutOfBoundsException - if the specify column < 0 || > getColumns()-1public double getColumnWeight(int column)
column - the specify columnjava.lang.IndexOutOfBoundsException - if the specify column < 0 || > getColumns()-1
public void setHgap(int index,
int gap)
index - the horizontal gap indexgap - the gap space to setjava.lang.IndexOutOfBoundsException - if the specify index < 0 || > getColumns()-2public int getHgap(int index)
index - the horizontal gap indexjava.lang.IndexOutOfBoundsException - if the specify index < 0 || > getColumns()-2
public void setVgap(int index,
int gap)
index - the vertical gap indexgap - the gap space to setjava.lang.IndexOutOfBoundsException - if the specify index < 0 || > getRows()-2public int getVgap(int index)
index - the vertical gap indexjava.lang.IndexOutOfBoundsException - if the specify index < 0 || > getRows()-2
public void addLayoutComponent(java.lang.String name,
java.awt.Component comp)
comp to the layout,
associating it
with the string specified by name.addLayoutComponent in interface java.awt.LayoutManagername - the string to be associated with the componentcomp - the component to be added
public void addLayoutComponent(java.awt.Component comp,
java.lang.Object constraints)
addLayoutComponent in interface java.awt.LayoutManager2comp - the component to be addedconstraints - where/how the component is added to the layout.public void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent in interface java.awt.LayoutManagercomp - the component to be removedpublic java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
preferredLayoutSize in interface java.awt.LayoutManagerparent - the container to be laid outminimumLayoutSize(java.awt.Container)public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
minimumLayoutSize in interface java.awt.LayoutManagerparent - the component to be laid outpreferredLayoutSize(java.awt.Container)public java.awt.Dimension maximumLayoutSize(java.awt.Container parent)
maximumLayoutSize in interface java.awt.LayoutManager2Component.getMaximumSize(),
LayoutManagerpublic float getLayoutAlignmentX(java.awt.Container parent)
getLayoutAlignmentX in interface java.awt.LayoutManager2public float getLayoutAlignmentY(java.awt.Container parent)
getLayoutAlignmentY in interface java.awt.LayoutManager2public void invalidateLayout(java.awt.Container parent)
invalidateLayout in interface java.awt.LayoutManager2public void layoutContainer(java.awt.Container parent)
layoutContainer in interface java.awt.LayoutManagerparent - the container to be laid out
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||