All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.awt.VerticalLayout

java.lang.Object
   |
   +----com.sun.wizards.awt.VerticalLayout

public class VerticalLayout
extends Object
implements LayoutManager, LayoutManager2, Serializable
VerticalLayout lays out components according to a specified percent. For example, if a component is added to VerticalLayout with a constraint of 50%, the component will be displayed in the center (vertically) of the container.

Graphic of a VerticalLayout arranging components at 25% and 70%.

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 VerticalLayout());
       add(new Separator(), "25");
       add(new FlowLabel("The separator is placed at 25% and this label is" +
 			" placed at 70%."), "70");
     }
 }
 

As the panel is resized, the components will be moved accordingly.


Constructor Index

 o VerticalLayout()
Creates a VerticalLayout manager with a horizontal and vertical gap of zero.
 o VerticalLayout(int, int)
Creates a VerticalLayout manager with the specified horizontal and vertical gaps.

Method Index

 o addLayoutComponent(Component, Object)
Adds the specified component to the layout, using the specified constraint object.
 o addLayoutComponent(String, Component)
Adds the specified component with the specified position to the layout.
 o getLayoutAlignmentX(Container)
Returns the alignment along the x axis.
 o getLayoutAlignmentY(Container)
Returns the alignment along the y axis.
 o invalidateLayout(Container)
Invalidates the layout, indicating that if the layout maanager has cached information it should be discarded.
 o layoutContainer(Container)
Lays out the container in the specified panel.
 o maximumLayoutSize(Container)
Returns the maximum size of this component.
 o minimumLayoutSize(Container)
Calculates the minmum size dimensions for the specified panel given the components in the specified parent container.
 o preferredLayoutSize(Container)
Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
 o removeLayoutComponent(Component)
Removes the specified component from the layout.

Constructors

 o VerticalLayout
 public VerticalLayout()
Creates a VerticalLayout manager with a horizontal and vertical gap of zero.

 o VerticalLayout
 public VerticalLayout(int hgap,
                       int vgap)
Creates a VerticalLayout manager with the specified horizontal and vertical gaps.

Parameters:
hgap - The horizontal gap between components.
vgap - The vertical gap between components.

Methods

 o addLayoutComponent
 public void addLayoutComponent(String position,
                                Component comp)
Adds the specified component with the specified position to the layout.

Parameters:
position - The position (an integer value between 0 and 100) indicating where the new component should be displayed.
comp - The component to be added.
 o addLayoutComponent
 public void addLayoutComponent(Component comp,
                                Object constraints)
Adds the specified component to the layout, using the specified constraint object. The constraint object for a VerticalLayout must be a String indicating a number between 0 and 100, which specifies the vertical position (in percent of target height) where the specified component should be displayed.

Parameters:
comp - The component to be added.
constraints - A string object indicating the position of the specified component.
 o removeLayoutComponent
 public void removeLayoutComponent(Component comp)
Removes the specified component from the layout.

Parameters:
comp - The component to be removed.
 o minimumLayoutSize
 public Dimension minimumLayoutSize(Container target)
Calculates the minmum size dimensions for the specified panel given the components in the specified parent container.

Parameters:
target - The component to be laid out.
 o preferredLayoutSize
 public Dimension preferredLayoutSize(Container target)
Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.

Parameters:
target - The component to be laid out.
 o layoutContainer
 public void layoutContainer(Container target)
Lays out the container in the specified panel.

Parameters:
target - The component which needs to be laid out.
 o maximumLayoutSize
 public Dimension maximumLayoutSize(Container target)
Returns the maximum size of this component.

Parameters:
target - The parent container.
 o 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 parent container.
 o 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 parent container.
 o invalidateLayout
 public void invalidateLayout(Container target)
Invalidates the layout, indicating that if the layout maanager has cached information it should be discarded.

Parameters:
target - The parent container.

All Packages  Class Hierarchy  This Package  Previous  Next  Index