|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.darwinsys.swingui.layout.EntryLayout
public class EntryLayout
A simple layout manager, for "Entry" areas ith e.g., a list of labels and their corresponding JTextFields. These typically look like:
Login: _______________ Password: _______________Basically two (or more) columns of different, but constant, widths. Note: all columns must be the same height!.
Construct instances by passing an array of the column width percentages (as doubles, fractions from 0.1 to 0.9, so 40%,60% would be {0.4, 0.6}). The length of this array uniquely determines the number of columns. Columns are forced to be the relevant widths. Note: As with GridLayout, the number of items added must be an even multiple of the number of columns. If not, exceptions may be thrown!
Field Summary | |
---|---|
protected int |
COLUMNS
The number of columns. |
protected int |
hpad
The actual padding |
protected static int |
HPAD
The default padding |
protected boolean |
validWidths
True if the list of widths was valid. |
protected int |
vpad
The actual padding |
protected static int |
VPAD
The default padding |
protected double[] |
widthPercentages
The array of widths, as decimal fractions (0.4 == 40%, etc.). |
Constructor Summary | |
---|---|
EntryLayout(double[] relWidths)
Construct an EntryLayout with widths and with default padding amounts. |
|
EntryLayout(double[] relWidths,
int h,
int v)
Construct an EntryLayout with widths and padding specified. |
Method Summary | |
---|---|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
Adds the specified component with the specified constraint to the layout; required by LayoutManager but not used. |
protected java.awt.Dimension |
computeLayoutSize(java.awt.Container parent,
int hp,
int vp)
Compute the size of the whole mess. |
void |
layoutContainer(java.awt.Container parent)
Lays out the container in the specified panel. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container parent)
Find the minimum Dimension for the specified container given the components therein. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container parent)
Calculates the preferred size dimensions for the specified panel given the components in the specified parent container. |
void |
removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout; required by LayoutManager, but does nothing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final double[] widthPercentages
protected final int COLUMNS
protected static final int HPAD
protected static final int VPAD
protected final int hpad
protected final int vpad
protected boolean validWidths
Constructor Detail |
---|
public EntryLayout(double[] relWidths, int h, int v)
relWidths
- Array of doubles specifying relative column widths.h
- Horizontal padding between itemsv
- Vertical padding between itemspublic EntryLayout(double[] relWidths)
relWidths
- Array of doubles specifying column widths.Method Detail |
---|
public void addLayoutComponent(java.lang.String name, java.awt.Component comp)
addLayoutComponent
in interface java.awt.LayoutManager
public void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent
in interface java.awt.LayoutManager
public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
preferredLayoutSize
in interface java.awt.LayoutManager
public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
minimumLayoutSize
in interface java.awt.LayoutManager
protected java.awt.Dimension computeLayoutSize(java.awt.Container parent, int hp, int vp)
parent
- The container in which to do the layout.hp
- The horizontal padding (may be zero)vp
- The Vertical Padding (may be zero).public void layoutContainer(java.awt.Container parent)
layoutContainer
in interface java.awt.LayoutManager
parent
- The Container whose children we are laying out.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |