All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.wizards.awt.HeaderLayout
java.lang.Object
|
+----com.sun.wizards.awt.HeaderLayout
- public class HeaderLayout
- extends Object
- implements LayoutManager, LayoutManager2, Serializable
HeaderLayout is a layout manager that positions objects
according to the spacing of objects in a separate panel.
That is, the HeaderLayout uses a separate panel as a
template to position its own objects.
The objects controlled by the HeaderLayout can be positioned
relative to the objects within the template. They can be
left justified, right justified, or centered.
Here is the code for this applet:
import java.applet.Applet;
import java.awt.*;
import com.sun.wizards.awt.*;
public class Test extends Applet
{
public void init()
{
setLayout(new BorderLayout());
Panel template = new Panel(new BiflowLayout());
template.add(new Label("Column 1"), "Left");
template.add(new Label("Column 2"), "Right");
template.add(new Label("Column 3"), "Right");
add(template, "North");
HeaderLayout headerLayout = new HeaderLayout(template,
new int[] {HeaderLayout.CENTER,
HeaderLayout.CENTER,
HeaderLayout.CENTER},
0, 0);
Panel panel = new Panel(headerLayout);
panel.add(new Checkbox("one", null, true));
panel.add(new Checkbox("two", null, true));
panel.add(new Checkbox("three", null, true));
add(panel, "South");
}
}
-
CENTER
- A tag used for centering objects to corresponding
objects in the header panel.
-
LEFT
- A tag used for aligning the left side of the objects
to the objects in the header panel.
-
RIGHT
- A tag used for aligning the right side of the objects
to the objects in the header panel.
-
HeaderLayout(Container)
- Creates a new layout manager that will lay out objects
according to the spacing of objects in the specified
panel.
-
HeaderLayout(Container, int[], int, int)
- Creates a new layout manager that will lay out objects
according to the spacing of objects in the specified
panel.
-
addLayoutComponent(Component, Object)
- Adds the specified component to the layout, using the specified constraint object.
-
addLayoutComponent(String, Component)
- Adds the specified component with the specified name to the layout.
-
getLayoutAlignmentX(Container)
- Returns the alignment along the x axis.
-
getLayoutAlignmentY(Container)
- Returns the alignment along the y axis.
-
invalidateLayout(Container)
- Invalidates the layout, indicating that if the layout manager has cached information,
it should be discarded.
-
layoutContainer(Container)
- Lays out the container in the specified panel.
-
maximumLayoutSize(Container)
- Returns the maximum size of this component.
-
minimumLayoutSize(Container)
- Calculates the minimum size dimensions for the specified panel given the components
in the specified parent container.
-
preferredLayoutSize(Container)
- Calculates the preferred size dimensions for the specified panel
given the components in the specified parent container.
-
removeLayoutComponent(Component)
- Removes the specified component from the layout.
LEFT
public static final int LEFT
- A tag used for aligning the left side of the objects
to the objects in the header panel.
CENTER
public static final int CENTER
- A tag used for centering objects to corresponding
objects in the header panel.
RIGHT
public static final int RIGHT
- A tag used for aligning the right side of the objects
to the objects in the header panel.
HeaderLayout
public HeaderLayout(Container header)
- Creates a new layout manager that will lay out objects
according to the spacing of objects in the specified
panel.
- Parameters:
- header - The panel of spaced objects that this
layout manager will align its objects
to.
HeaderLayout
public HeaderLayout(Container header,
int alignment[],
int hgap,
int vgap)
- Creates a new layout manager that will lay out objects
according to the spacing of objects in the specified
panel. The layout will align objects according to the
values in the specified alignment array. Objects will
be laid out with the specified horizontal and vertical
gaps.
- Parameters:
- header - The panel of spaced objects that this
layout manager will align its objects
to.
- alignment - The desired alignment of each object.
- hgap - The horizontal gap between components.
- vgap - The vertical gap between components.
addLayoutComponent
public void addLayoutComponent(String name,
Component comp)
- Adds the specified component with the specified name to the layout.
- Parameters:
- name - The component name.
- comp - The component to be added.
addLayoutComponent
public void addLayoutComponent(Component comp,
Object constraints)
- Adds the specified component to the layout, using the specified constraint object.
The HeaderLayout ignores the constraint object.
- Parameters:
- comp - The component to be added.
- constraints - Not used.
removeLayoutComponent
public void removeLayoutComponent(Component comp)
- Removes the specified component from the layout.
- Parameters:
- comp - The component to be removed.
minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)
- Calculates the minimum size dimensions for the specified panel given the components
in the specified parent container.
- Parameters:
- parent - The component to be laid out.
- Returns:
- The minimum size.
preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
- Calculates the preferred size dimensions for the specified panel
given the components in the specified parent container.
- Parameters:
- parent - The component to be laid out.
- Returns:
- The preferred size.
layoutContainer
public void layoutContainer(Container parent)
- Lays out the container in the specified panel.
- Parameters:
- parent - The component which needs to be laid out.
maximumLayoutSize
public Dimension maximumLayoutSize(Container target)
- Returns the maximum size of this component.
- Parameters:
- parent - The component to be laid out.
- Returns:
- The maximum size.
getLayoutAlignmentX
public float getLayoutAlignmentX(Container parent)
- Returns the alignment along the x axis. This specifies how the component would
like to be aligned relative to other components. The value should be a number
between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the
furthest away from the origin, 0.5 is centered, etc.
- Parameters:
- parent - The component that needs to be laid out.
getLayoutAlignmentY
public float getLayoutAlignmentY(Container parent)
- Returns the alignment along the y axis. This specifies how the component would
like to be aligned relative to other components. The value should be a number
between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the
furthest away from the origin, 0.5 is centered, etc.
- Parameters:
- parent - The component that needs to be laid out.
invalidateLayout
public void invalidateLayout(Container target)
- Invalidates the layout, indicating that if the layout manager has cached information,
it should be discarded.
- Parameters:
- parent - The component to be invalidated.
All Packages Class Hierarchy This Package Previous Next Index