|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.programix.gui.layout.AbstractTableLayout
com.programix.gui.layout.ShelfLayout
public class ShelfLayout
Lays out components in a single horizontal row (on a "shelf"). Each component added gets its preferred width. The column gap specifies how many pixels are between each column on the shelf (the inherited row gap has no effect on this layout as there is always only one row). The border gap specifies the distance between the laid out components and the container's own border (if any).
The AnchorPoint specified for the layout manager indicates where the
contents of the container should be placed if there is extra room.
See AbstractTableLayout.getAnchorPoint(), AbstractTableLayout.setAnchorPoint(com.programix.gui.AnchorPoint), and the
AnchorPoint that may be specified during construction.
When components are added to this container, an optional constraint
can be specified for each. If no constraint is specified (or if null
is used as the constraint), the default of AnchorPoint.NORTH
will be used.

public static JPanel createBasicDemoPane() {
JPanel shelf = new JPanel(new ShelfLayout());
shelf.setBorder(
BorderFactory.createMatteBorder(10, 10, 10, 10, Color.BLUE));
shelf.add(makeLabel("1", 50, 20, Color.RED));
shelf.add(makeLabel("2", 20, 50, Color.YELLOW));
shelf.add(makeLabel("3", 35, 40, Color.GREEN), AnchorPoint.SOUTH);
shelf.add(makeLabel("4", 50, 45, Color.MAGENTA));
shelf.add(makeLabel("5", 55, 80, Color.ORANGE));
shelf.add(makeLabel("6", 15, 25, Color.CYAN));
return shelf;
}
public static JLabel makeLabel(String text,
int prefWidth,
int prefHeight,
Color bgColor) {
JLabel label = new JLabel(text, JLabel.CENTER);
label.setOpaque(true);
label.setBackground(bgColor);
label.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
label.setPreferredSize(new Dimension(prefWidth, prefHeight));
return label;
}
AnchorTableLayout,
FormLayout,
ColumnButtonLayout,
RowButtonLayout,
StackLayout,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.programix.gui.layout.AbstractTableLayout |
|---|
AbstractTableLayout.CellData |
| Field Summary |
|---|
| Fields inherited from class com.programix.gui.layout.AbstractTableLayout |
|---|
anchorPoint, borderGap, colGap, columnCoordinator, DEFAULT_ANCHOR_POINT, DEFAULT_BORDER_GAP, DEFAULT_COL_GAP, DEFAULT_ROW_GAP, ignoreInvisibleComponents, rowGap |
| Constructor Summary | |
|---|---|
ShelfLayout()
Creates a single row (shelf) layout. |
|
ShelfLayout(AnchorPoint anchorPoint)
Creates a single row (shelf) layout. |
|
ShelfLayout(int borderGap)
Creates a single row (shelf) layout. |
|
ShelfLayout(int colGap,
int borderGap)
Creates a single row (shelf) layout. |
|
ShelfLayout(int colGap,
int borderGap,
AnchorPoint anchorPoint)
Creates a single row (shelf) layout. |
|
| Method Summary | |
|---|---|
void |
addLayoutComponent(Component comp,
Object constraints)
Called by the graphical subsystem when a component is being added to the container with constraints. |
protected AbstractTableLayout.CellData |
createCellData(Container pane)
|
AnchorPoint |
getDefaultCellAnchorPoint()
Returns the current default AnchorPoint used to position a component within its cell boundaries when no constraints are specified during the add of the component. |
float |
getLayoutAlignmentX(Container target)
|
float |
getLayoutAlignmentY(Container target)
|
void |
invalidateLayout(Container target)
|
Dimension |
maximumLayoutSize(Container target)
|
void |
removeLayoutComponent(Component comp)
Called by the graphical subsystem when a component is being removed from the container. |
void |
setDefaultCellAnchorPoint(AnchorPoint ap)
Changes the current default AnchorPoint used to position a component within its cell boundaries when no constraints are specified during the add of the component. |
| Methods inherited from class com.programix.gui.layout.AbstractTableLayout |
|---|
addLayoutComponent, getAnchorPoint, getBorderGap, getColumnCoordinator, getColumnGap, getRowGap, isIgnoreInvisibleComponents, layoutContainer, minimumLayoutSize, preferredLayoutSize, setAnchorPoint, setBorderGap, setColumnCoordinator, setColumnGap, setIgnoreInvisibleComponents, setRowGap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.awt.LayoutManager |
|---|
addLayoutComponent, layoutContainer, minimumLayoutSize, preferredLayoutSize |
| Constructor Detail |
|---|
public ShelfLayout(int colGap,
int borderGap,
AnchorPoint anchorPoint)
colGap - space between columns.
See setColumnGap().borderGap - space around the outside of the row.
See setBorderGap().anchorPoint - region to anchor to when there is extra space
See setAnchorPoint().
public ShelfLayout(int colGap,
int borderGap)
DEFAULT_ANCHOR_POINT.
colGap - space between columns.
See setColumnGap().borderGap - space around the outside of the form.
See setBorderGap().public ShelfLayout(AnchorPoint anchorPoint)
DEFAULT_COL_GAP.
Uses DEFAULT_BORDER_GAP.
anchorPoint - region to anchor to when there is extra space
See setAnchorPoint().public ShelfLayout(int borderGap)
DEFAULT_COL_GAP.
Uses DEFAULT_ANCHOR_POINT.
borderGap - space around the outside of the form.
See setBorderGap().public ShelfLayout()
DEFAULT_COL_GAP.
Uses DEFAULT_BORDER_GAP.
Uses DEFAULT_ANCHOR_POINT.
| Method Detail |
|---|
public void removeLayoutComponent(Component comp)
removeLayoutComponent in interface LayoutManagerremoveLayoutComponent in class AbstractTableLayout
public void addLayoutComponent(Component comp,
Object constraints)
addLayoutComponent in interface LayoutManager2public Dimension maximumLayoutSize(Container target)
maximumLayoutSize in interface LayoutManager2public float getLayoutAlignmentX(Container target)
getLayoutAlignmentX in interface LayoutManager2public float getLayoutAlignmentY(Container target)
getLayoutAlignmentY in interface LayoutManager2public void invalidateLayout(Container target)
invalidateLayout in interface LayoutManager2public AnchorPoint getDefaultCellAnchorPoint()
public void setDefaultCellAnchorPoint(AnchorPoint ap)
protected AbstractTableLayout.CellData createCellData(Container pane)
createCellData in class AbstractTableLayout
|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||