|
MDateSelector | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmseries.utils.FormLayout
mseries.utils.FormCellLayout
public class FormCellLayout
A layout manager that lays out a container in one, horizonatal row. The resizing and placement policies are inherited from FormLayout. Components are added to their container using FormConstraints and this layout manager then ignores many of the values !. The intention is that it is easy for the application programmer to use this layout manager, it does not allow anything that could not be achieved with careful use of FormLayout. It is designed to be used to manage a small group of components that should ideally be placed in the same cell in a FormLayout. The image below shows a FormLayout with superimposed grid lines, the cell (1,1) contains 3 components, two JTextFields and a JLabel.
This cell contains a JPanel that has a FormCellLayout, the FormLayout automatically calculates the insets for its child components, the left most component gets zero left insets, the right most one zero right insets, all components get zero top and bottom insets. These values can not be over ridden by the application program so the FormCellLayout may not be the most appropriate Layout Manager to use outside of a FormLayout. (Remember the cell itself has insets)
As components are added to the container, their x coordinate is automatically calculated, the first component to be added gets gridx=0, the next 1 etc. The gridy value is always zero as this layout manager can deal with only one row.
The following code shows the usage of the FormCellLayout to produce the effects shown in the sample image above:
public JPanel makeUOMPanel()
{
JPanel p = new JPanel();
p.setLayout(new FormCellLayout());
FormConstraints c =new FormConstraints();
JTextField t1= new JTextField(5);
c.anchor=FormConstraints.WEST;
p.add(t1, c);
c.anchor=FormConstraints.EAST;
JLabel l2=new JLabel("Printer");
p.add(l2, c);
JTextField t2= new JTextField(5);
c.anchor=FormConstraints.WEST;
p.add(t2, c);
return p;
}
The complete panel is added to the FormLayout with the following lines of code
JPanel ip=makeUOMPanel();
c.gridx=FormConstraints.RELATIVE;
c.anchor=FormConstraints.WEST;
c.spansColumns=true;
p.add(ip, c);
FormLayout,
Serialized Form| Field Summary |
|---|
| Fields inherited from class mseries.utils.FormLayout |
|---|
comptable, defaultConstraints, info, MAXGRIDSIZE, MINHEIGHT, MINWIDTH |
| Constructor Summary | |
|---|---|
FormCellLayout()
|
|
| Method Summary | |
|---|---|
void |
addLayoutComponent(Component comp,
Object constraints)
Adds the specified component to the layout, using the specified constraint object. |
void |
layoutContainer(Container parent)
Lays out the specified container using this form layout. |
protected void |
resetConstraints()
|
| Methods inherited from class mseries.utils.FormLayout |
|---|
addLayoutComponent, applyGravity, calculateGridSize, getConstraints, getInfo, getLayoutAlignmentX, getLayoutAlignmentY, invalidateLayout, lookupConstraints, maximumLayoutSize, minimumLayoutSize, preferredLayoutSize, removeLayoutComponent, setComponentBounds, setConstraints |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FormCellLayout()
| Method Detail |
|---|
public void layoutContainer(Container parent)
FormLayout
object.
Most applications do not call this method directly.
layoutContainer in interface LayoutManagerlayoutContainer in class FormLayoutparent - the container in which to do the layout.Container,
Container.doLayout()
public void addLayoutComponent(Component comp,
Object constraints)
addLayoutComponent in interface LayoutManager2addLayoutComponent in class FormLayoutcomp - the component to be added.constraints - an object that determines how
the component is added to the layout.protected void resetConstraints()
|
MDateSelector | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||