public class FormLayout
extends LayoutManager
Fields
static int FREE_LABEL
static int FREE_FIELD
static int LABEL_ON_TOP
Constructors
FormLayout()
FormLayout(int gap)
FormLayout(int internalHGap, int internalVGap, int externalHGap, int externalVGap)
Methods
void layoutContainer(Container parent)
Dimension minimumLayoutSize(Container parent)
Dimension preferredLayoutSize(Container parent)
void removeLayoutComponent(Component component)
void add(Component component, int row, int column)
void add(Component label, Component field, int row, int column)
void add(Component label, Component field, int row, int column, int mode)
void add(Component component, int row, int column, double fillRightPct)
void add(Component label, Component field, int row, int column, double fillRightPct)
void add(Component label, Component field, int row, int column, int mode, double fillRightPct)
void addMultiRow(Component component, int startRow, int endRow, int column)
void addMultiRow(Component label, Component field, int startRow, int endRow, int column)
void addMultiRow(Component label, Component field, int startRow, int endRow, int column, int mode)
void addMultiRow(Component component, int startRow, int endRow, int column, double fillRightPct)
void addMultiRow(Component label, Component field, int startRow, int endRow, int column, double fillRightPct)
void addMultiRow(Component label, Component field, int startRow, int endRow, int column, int mode, double fillRightPct)
int getInternalHGap()
int getInternalVGap()
int getExternalHGap()
int getExternalVGap()
void setInternalHGap(int gap)
void setInternalVGap(int gap)
void setExternalHGap(int gap)
void setExternalVGap(int gap)
void setDefaultFillRightPct(double fillRightPct)
void getDefaultFillRightPct()
fillRightPct
Domain: 0 <= fillRightPct <= 1
This parameter specifies how far beyond its preferred width a component is willing to stretch when the horizontal space available exceeds the component's preferred width. If the component can fill the entire space with a width of:
component.getPreferredSize() + ((component.getPreferredSize() - component.getMinimumSize()) * fillRightPct),
then it will do so. Otherwise, it will stay at its preferred width and leave blank space to its right. A fillRightPct of 1 will always stretch the component to fill the entire space available (up to its maxiumum width).
Use this to right justify your form by setting the fillRightPct of each of the rightmost components to 1. Or, call setDefaultFillRightPct(1) before adding the rightmost components. Use an intermediate value if you like the right justified effect, but don't want your small components to stretch beyond proportion to their width and flexibility. Set the fillRightPct to 0 if you don't want a component to stretch beyond its preferred width (the initial fillRightPct default is 0).
Terminated Methods
from javax.swing.LayoutManager
void addLayoutComponent(String name, Component comp)