|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--attachlayout.AttachLayout
LayoutManager that allows to organize components
in a container by defining attachments for every side of a component (See
also Sample included).
An attachment is defined by specifying an anchor, connection type
and offset.
Inner Class Summary | |
static class |
AttachLayout.Constraints
Defines constraints by specifying an anchor, connection type and offset for every side of the component to lay out. |
Fields inherited from interface attachlayout.AttachConstants |
BOTTOM, COMPONENT_PREFERRED, ELASTIC, FIXED, LEFT, RIGHT, TOP |
Constructor Summary | |
AttachLayout()
Creates a new AttachLayout instance. |
Method Summary | |
void |
addLayoutComponent(java.awt.Component comp,
java.lang.Object constraints)
Adds the specified component to the layout, using the specified constraint object. |
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
Deprecated. replaced by addLayoutComponent(Component, Object) .
This method is not implemented. |
void |
checkSolvable()
Checks if the current structure of constraints can be solved. |
void |
defineBox(java.lang.String name,
AttachLayout.Constraints cts)
Defines and adds a box to this layout. |
void |
defineColumn(java.lang.String name,
AttachLayout.Constraints cts)
Defines and adds a box to this layout. |
void |
defineRow(java.lang.String name,
AttachLayout.Constraints cts)
Defines and adds a box to this layout. |
static int |
getBackSide(int side)
Returns the back side of the given side. |
AttachLayout.Constraints |
getConstraints()
Returns a new Constraints instance. |
static int |
getFrontSide(int side)
Returns the front side of the given side. |
float |
getLayoutAlignmentX(java.awt.Container parent)
Returns the alignment along the x axis. |
float |
getLayoutAlignmentY(java.awt.Container parent)
Returns the alignment along the y axis. |
static int |
getOppositeSide(int side)
Returns the opposite side of the given side. |
void |
invalidateLayout(java.awt.Container target)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. |
static boolean |
isFrontSide(int side)
Returns true if the given side is LEFT or TOP side. |
void |
layoutContainer(java.awt.Container target)
Lays out the container argument using this layout. |
static void |
main(java.lang.String[] args)
|
java.awt.Dimension |
maximumLayoutSize(java.awt.Container target)
Returns the maximum dimensions for this layout given the components in the specified target container. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container target)
Determines the minimum size of the container using this layout manager. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container target)
Determines the preferred size of the container using this layout manager, based on the components in the container. |
void |
removeLayoutComponent(java.awt.Component comp)
Removes the specified component from this layout. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AttachLayout()
Method Detail |
public AttachLayout.Constraints getConstraints()
public void addLayoutComponent(java.awt.Component comp, java.lang.Object constraints)
Container.add
method with the same argument types.addLayoutComponent
in interface java.awt.LayoutManager2
comp
- the component to be added.constraints
- an object that specifies how and where
the component is added to the layout.java.lang.IllegalArgumentException
- if the constraint object is not
an instance of Constraints or if it does not pass number of integrity
checks.Container.add(java.awt.Component, java.lang.Object)
public void addLayoutComponent(java.lang.String name, java.awt.Component comp)
addLayoutComponent(Component, Object)
.
This method is not implemented.
addLayoutComponent
in interface java.awt.LayoutManager
java.lang.RuntimeException
- always.public void removeLayoutComponent(java.awt.Component comp)
remove
or
removeAll
methods. Most applications do not call this
method directly.removeLayoutComponent
in interface java.awt.LayoutManager
comp
- the component to be removed.Container.remove(java.awt.Component)
,
Container.removeAll()
public java.awt.Dimension minimumLayoutSize(java.awt.Container target)
Most applications do not call this method directly.
This method is called when a container calls its
getMinimumSize
method.
minimumLayoutSize
in interface java.awt.LayoutManager
target
- the container in which to do the layout.Container
,
java.awt.BorderLayout#preferredLayoutSize
,
Container.getMinimumSize()
public java.awt.Dimension preferredLayoutSize(java.awt.Container target)
Most applications do not call this method directly. This method
is called when a container calls its getPreferredSize
method.
preferredLayoutSize
in interface java.awt.LayoutManager
target
- the container in which to do the layout.Container
,
java.awt.BorderLayout#minimumLayoutSize
,
Container.getPreferredSize()
public java.awt.Dimension maximumLayoutSize(java.awt.Container target)
maximumLayoutSize
in interface java.awt.LayoutManager2
target
- the component which needs to be laid out.Container
,
minimumLayoutSize(java.awt.Container)
,
preferredLayoutSize(java.awt.Container)
public float getLayoutAlignmentX(java.awt.Container parent)
getLayoutAlignmentX
in interface java.awt.LayoutManager2
public float getLayoutAlignmentY(java.awt.Container parent)
getLayoutAlignmentY
in interface java.awt.LayoutManager2
public void invalidateLayout(java.awt.Container target)
invalidateLayout
in interface java.awt.LayoutManager2
public void layoutContainer(java.awt.Container target)
This method actually reshapes the components in the specified container in order to satisfy the constraints of this layout.
Most applications do not call this method directly. This method
is called when a container calls its doLayout
method.
layoutContainer
in interface java.awt.LayoutManager
target
- the container in which to do the layout.Container
,
Container.doLayout()
public void defineBox(java.lang.String name, AttachLayout.Constraints cts)
name
- a valid string representing the boxe's name, must not be null.cts
- the constraints to layout the box in the container, must not be null.public void defineColumn(java.lang.String name, AttachLayout.Constraints cts)
name
- a valid string representing the boxe's name, must not be null.cts
- the constraints to layout the box in the container, must not be null.public void defineRow(java.lang.String name, AttachLayout.Constraints cts)
name
- a valid string representing the boxe's name, must not be null.cts
- the constraints to layout the box in the container, must not be null.public void checkSolvable()
java.lang.RuntimeException
- when the structure cannot be solved. The message
of the exception indicates the kind of problem.public static int getOppositeSide(int side)
side
- 0 for TOP, 1 for LEFT, 2 for BOTTOM or 3 for RIGHT.public static boolean isFrontSide(int side)
side
- 0 for TOP, 1 for LEFT, 2 for BOTTOM or 3 for RIGHT.public static int getFrontSide(int side)
side
is LEFT or RIGHT, LEFT is returned, when TOP or BOTTOM, TOP is returned.side
- 0 for TOP, 1 for LEFT, 2 for BOTTOM or 3 for RIGHT.public static int getBackSide(int side)
side
is LEFT or RIGHT, RIGHT is returned, when TOP or BOTTOM, BOTTOM is returned.side
- 0 for TOP, 1 for LEFT, 2 for BOTTOM or 3 for RIGHT.public static void main(java.lang.String[] args) throws java.lang.Exception
|
Copyright © 2003-2008, Paul Neyens All Rights Reserved. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |