public class GridContainer extends WidgetContainer
In addition to the event types generated by all Widgets, GridContainers generate the following event types:
Constructor and Description |
---|
GridContainer(int cols,
int rows)
Create a new GridContainer.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Widget widget,
int col,
int row)
Add a Widget to this container, using the default LayoutInfo to position it.
|
void |
add(Widget widget,
int col,
int row,
LayoutInfo layout)
Add a Widget to this container.
|
Widget |
getChild(int col,
int row)
Get the child in a particular cell.
|
java.awt.Point |
getChildCell(Widget widget)
Get the cell containing the specified Widget.
|
int |
getChildCount()
Get the number of children in this container.
|
LayoutInfo |
getChildLayout(int col,
int row)
Get the LayoutInfo for the Widget in a particular cell.
|
LayoutInfo |
getChildLayout(Widget widget)
Get the LayoutInfo for a particular Widget.
|
java.util.Collection<Widget> |
getChildren()
Get a Collection containing all child Widgets of this container.
|
int |
getColumnCount()
Get the number of columns in the grid.
|
javax.swing.JPanel |
getComponent()
Get the java.awt.Component corresponding to this Widget.
|
LayoutInfo |
getDefaultLayout()
Get the default LayoutInfo.
|
java.awt.Dimension |
getMinimumSize()
Get the smallest size at which this Widget can reasonably be drawn.
|
java.awt.Dimension |
getPreferredSize()
Get the preferred size at which this Widget will look best.
|
int |
getRowCount()
Get the number of rows in the grid.
|
void |
layoutChildren()
Layout the child Widgets.
|
void |
remove(int col,
int row)
Remove the Widget in a particular cell from this container.
|
void |
remove(Widget widget)
Remove a child Widget from this container.
|
void |
removeAll()
Remove all child Widgets from this container.
|
void |
setChildLayout(int col,
int row,
LayoutInfo layout)
Set the LayoutInfo for the Widget in a particular cell.
|
void |
setChildLayout(Widget widget,
LayoutInfo layout)
Set the LayoutInfo for a particular Widget.
|
void |
setColumnCount(int cols)
Set the number of columns in the grid.
|
void |
setDefaultLayout(LayoutInfo layout)
Set the default LayoutInfo.
|
void |
setRowCount(int rows)
Set the number of rows in the grid.
|
isOpaque, setOpaque
addEventLink, dispatchEvent, getBackground, getBounds, getCursor, getFont, getMaximumSize, getName, getParent, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible
addEventLink, addEventLink, removeEventLink
public GridContainer(int cols, int rows)
cols
- the number of columns in the gridrows
- the number of rows in the gridpublic javax.swing.JPanel getComponent()
Widget
getComponent
in class Widget
public int getChildCount()
getChildCount
in class WidgetContainer
public java.util.Collection<Widget> getChildren()
getChildren
in class WidgetContainer
public Widget getChild(int col, int row)
col
- the column for which to get the Widgetrow
- the row for which to get the Widgetpublic void layoutChildren()
layoutChildren
in class WidgetContainer
public void add(Widget widget, int col, int row)
widget
- the Widget to addcol
- the column in which to place the Widgetrow
- the row in which to place the Widgetpublic void add(Widget widget, int col, int row, LayoutInfo layout)
widget
- the Widget to addcol
- the column in which to place the Widgetrow
- the row in which to place the Widgetlayout
- the LayoutInfo to use for this Widget. If null, the default LayoutInfo will be used.public LayoutInfo getChildLayout(int col, int row)
col
- the column of the Widget for which to get the LayoutInforow
- the row of the Widget for which to get the LayoutInfopublic void setChildLayout(int col, int row, LayoutInfo layout)
col
- the column of the Widget for which to set the LayoutInforow
- the row of the Widget for which to set the LayoutInfolayout
- the new LayoutInfo. If null, the default LayoutInfo will be usedpublic LayoutInfo getChildLayout(Widget widget)
widget
- the Widget for which to get the LayoutInfopublic void setChildLayout(Widget widget, LayoutInfo layout)
widget
- the Widget for which to set the LayoutInfolayout
- the new LayoutInfo. If null, the default LayoutInfo will be usedpublic LayoutInfo getDefaultLayout()
public void setDefaultLayout(LayoutInfo layout)
public int getRowCount()
public void setRowCount(int rows)
public int getColumnCount()
public void setColumnCount(int cols)
public void remove(Widget widget)
remove
in class WidgetContainer
widget
- the Widget to removepublic void remove(int col, int row)
col
- the column from which to remove the Widgetrow
- the row from which to remove the Widgetpublic void removeAll()
removeAll
in class WidgetContainer
public java.awt.Point getChildCell(Widget widget)
widget
- the Widget to locatepublic java.awt.Dimension getMinimumSize()
getMinimumSize
in class Widget
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class Widget
Written by Peter Eastman.