matthew.awt
Class StrutLayout.Strut

java.lang.Object
  |
  +--matthew.awt.StrutLayout.Strut

public static final class StrutLayout.Strut
extends java.lang.Object

Represents a strut going from a parent component to a child (see StrutLayout.StrutConstraint for a description of struts). This class is used in conjunction with addStruts () as an alternative to a sequence of addLayoutComponent (component, new StrutConstraint (...)) statements.

Example:

StrutLayout.Strut struts [] =
{new StrutLayout.Strut (nameLabel, nameField,
StrutLayout.MID_RIGHT, StrutLayout.MID_LEFT,
StrutLayout.EAST),
new StrutLayout.Strut (ageField, nameField,
StrutLayout.BOTTOM_LEFT, StrutLayout.TOP_LEFT,
StrutLayout.SOUTH)
};

Panel panel = new Panel ();
StrutLayout strutLayout = new StrutLayout ();

panel.setLayout (strutLayout);
panel.add (rootComponent);
StrutLayout.addStruts (panel, struts);

See Also:
StrutLayout.StrutConstraint, StrutLayout.addStruts(java.awt.Container, matthew.awt.StrutLayout.Strut[])

Field Summary
 java.awt.Component child
           
 int direction
           
 int fromConnector
           
 int length
           
 java.awt.Component parent
           
 int toConnector
           
 
Constructor Summary
StrutLayout.Strut(java.awt.Component parent, java.awt.Component child, int fromConnector, int toConnector, int direction)
          Creates a strut going from a parent component to a child component with a default length
StrutLayout.Strut(java.awt.Component parent, java.awt.Component child, int fromConnector, int toConnector, int direction, int length)
          Creates a strut going from a parent component to a child component.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

public java.awt.Component parent

child

public java.awt.Component child

fromConnector

public int fromConnector

toConnector

public int toConnector

direction

public int direction

length

public int length
Constructor Detail

StrutLayout.Strut

public StrutLayout.Strut(java.awt.Component parent,
                         java.awt.Component child,
                         int fromConnector,
                         int toConnector,
                         int direction)
Creates a strut going from a parent component to a child component with a default length
Parameters:
parent - The parent component.
child - The child component.
fromConnector - The connector on the parent to attach the strut to (eg. StrutLayout.TOP_RIGHT).
toConnector - The connector on the child to attach the strut to (eg. StrutLayout.TOP_LEFT).
direction - The direction of the strut. One of StrutLayout.NORTH, StrutLayout.SOUTH, StrutLayout.EAST or StrutLayout.WEST.
See Also:
StrutLayout.Strut#Strut(java.awt.Component, java.awt.Component, int, int, int, int), StrutLayout.StrutConstraint, StrutLayout.getDefaultStrutLength()

StrutLayout.Strut

public StrutLayout.Strut(java.awt.Component parent,
                         java.awt.Component child,
                         int fromConnector,
                         int toConnector,
                         int direction,
                         int length)
Creates a strut going from a parent component to a child component.
Parameters:
parent - The parent component.
child - The child component.
fromConnector - The connector on the parent to attach the strut to (eg. StrutLayout.TOP_RIGHT).
toConnector - The connector on the child to attach the strut to (eg. StrutLayout.TOP_LEFT).
direction - The direction of the strut. One of StrutLayout.NORTH, StrutLayout.SOUTH, StrutLayout.EAST or StrutLayout.WEST.
length - The length (in pixels) of the strut.
See Also:
StrutLayout.Strut#Strut(java.awt.Component, java.awt.Component, int, int, int), StrutLayout.StrutConstraint