|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.simplelayout.SimpleLayout
public class SimpleLayout
Simple Layout Manager which organizes its components in columns and rows. Per default, there are 2 columns. The components are just added in the right order. You can specify how the columns are aligned, by setting the row constraints. Example:
SimpleLayout layout = new SimpleLayout(); // align the labels to the right layout.setAlignment(0, SimpleLayout.RIGHT); JPanel panel = new JPanel(layout); panel.add(new JLabel("Name")); panel.add(new JTextField()); // Textfield 1 panel.add(new JLabel("Street")); panel.add(new JTextField()); // Textfield 2This creates a Panel with two rows and two columns. The labels are put in the first column, the text fields in the second:
Name | Textfield 1 |
Street | Textfield 2 |
Field Summary | |
---|---|
static SimpleLayoutConstraints |
CENTER
put the components in the center corner |
static SimpleLayoutConstraints |
EAST
put the components center right corner |
static SimpleLayoutConstraints |
NORTH
put the components top center corner |
static SimpleLayoutConstraints |
NORTHEAST
put the components top right corner |
static SimpleLayoutConstraints |
NORTHWEST
put the components top left corner (default) |
static SimpleLayoutConstraints |
SOUTH
put the components lower center corner |
static SimpleLayoutConstraints |
SOUTHEAST
put the components lower right corner |
static SimpleLayoutConstraints |
SOUTHWEST
put the components lower left corner |
static SimpleLayoutConstraints |
WEST
put the components center left corner |
Constructor Summary | |
---|---|
SimpleLayout()
Constructor with two columns and no gaps. |
|
SimpleLayout(int columns)
Constructor with no gaps. |
|
SimpleLayout(int columns,
int hgap,
int vgap)
Constructor with no gaps. |
Method Summary | |
---|---|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component c)
Do nothing. |
int |
getHgap()
Returns the horizontal gap between components. |
int |
getVgap()
Returns the vertical gap between components. |
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 c)
Do nothing. |
void |
setAlignment(int col,
SimpleLayoutConstraints align)
Set the alignment for the given column. |
void |
setHgap(int hgap)
Sets the horizontal gap between components. |
void |
setVgap(int vgap)
Sets the vertical gap between components. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final SimpleLayoutConstraints NORTH
public static final SimpleLayoutConstraints NORTHEAST
public static final SimpleLayoutConstraints EAST
public static final SimpleLayoutConstraints SOUTHEAST
public static final SimpleLayoutConstraints SOUTH
public static final SimpleLayoutConstraints SOUTHWEST
public static final SimpleLayoutConstraints WEST
public static final SimpleLayoutConstraints NORTHWEST
public static final SimpleLayoutConstraints CENTER
Constructor Detail |
---|
public SimpleLayout()
public SimpleLayout(int columns)
columns
- number of columnspublic SimpleLayout(int columns, int hgap, int vgap)
columns
- number of columnshgap
- horizontal gapvgap
- vertical gapMethod Detail |
---|
public void addLayoutComponent(java.lang.String name, java.awt.Component c)
addLayoutComponent
in interface java.awt.LayoutManager
name
- unusedc
- unusedLayoutManager.addLayoutComponent(java.lang.String, java.awt.Component)
public int getHgap()
public int getVgap()
public void layoutContainer(java.awt.Container parent)
layoutContainer
in interface java.awt.LayoutManager
LayoutManager.layoutContainer(java.awt.Container)
public java.awt.Dimension maximumLayoutSize(java.awt.Container parent)
parent
- parent container
public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
minimumLayoutSize
in interface java.awt.LayoutManager
parent
- parent container
LayoutManager.minimumLayoutSize(java.awt.Container)
public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
preferredLayoutSize
in interface java.awt.LayoutManager
LayoutManager.preferredLayoutSize(java.awt.Container)
public void removeLayoutComponent(java.awt.Component c)
removeLayoutComponent
in interface java.awt.LayoutManager
LayoutManager.removeLayoutComponent(java.awt.Component)
public void setAlignment(int col, SimpleLayoutConstraints align)
col
- the column to set the alignment foralign
- the alignmentpublic void setHgap(int hgap)
hgap
- the horizontal gap between componentspublic void setVgap(int vgap)
vgap
- the vertical gap between components
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |