|
Sharkysoft home | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--lava.gui.ScaledLayout
Arbitrary layout control.
Details: ScaledLayout is a constraints-based layout manager that gives you freestyle layout control over elements in a Container. ScaledLayout's constraints are Rectangles that specify the exact bounds of their associated Components. When performing layouts, ScaledLayout always attempts to make each component fit exactly in the bounds of the supplied rectangle.
When instantiating a ScaledLayout, you must specify a minimum, preferred, and maximum layout size. (If you only specify one size, these three parameters are assumed to be the same.) When laying out components, ScaledLayout checks to see how much room it has to lay them out in (i.e., by calling the container's getSize method). If that amount is different than the preferred size, then ScaledLayout automatically scales each component's boundaries so that they will retain the same relative sizes and positions. (How each individual component handles the scaling operation is up to the component.)
If components are arranged in a manner such that their bounding rectangles overlap, their Z-ordering is controlled by their parent container, not this layout manager.
| Constructor Summary | |
ScaledLayout(java.awt.Dimension pref)
Specifies an inflexible size. |
|
ScaledLayout(java.awt.Dimension min,
java.awt.Dimension pref,
java.awt.Dimension max)
Specifies minimum, preferred, and maximum sizes. |
|
| Method Summary | |
void |
addLayoutComponent(java.awt.Component component,
java.lang.Object constraints)
Binds the added component to its rectangle. |
void |
addLayoutComponent(java.lang.String s,
java.awt.Component component)
Reserved. |
float |
getLayoutAlignmentX(java.awt.Container target)
Returns horizontal alignment information. |
float |
getLayoutAlignmentY(java.awt.Container target)
Returns vertical alignment information. |
void |
invalidateLayout(java.awt.Container target)
Reserved. |
void |
layoutContainer(java.awt.Container target)
Lays out the container's children. |
java.awt.Dimension |
maximumLayoutSize(java.awt.Container target)
Returns maximum layout size. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container target)
Returns minimum layout size. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container target)
Returns preferred layout size. |
void |
removeLayoutComponent(java.awt.Component component)
Removes component from layout. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ScaledLayout(java.awt.Dimension pref)
Details: This constructor initializes a new instance using pref as the reference size. The preferred, minimum, and maximum layout sizes are set to pref as well.
pref - the layout size
public ScaledLayout(java.awt.Dimension min,
java.awt.Dimension pref,
java.awt.Dimension max)
Details: This constructor initializes a new instance using min, pref, and max as the minimum, preferred, and maximum sizes, respectively. pref is also taken as the reference size.
The sequence (min, pref, max) must be a non-decreasing sequence or the constructor will throw an IllegalArgumentException.
min - the minimum sizepref - the preferred sizemax - the maximum size| Method Detail |
public void addLayoutComponent(java.awt.Component component,
java.lang.Object constraints)
Details: This method is called by the Container when a Component is added to Container with a constraint. For ScaledLayout, all constraints must be Rectangles or null. If null is used, the Rectangle returned by the component's getBounds method is used.
addLayoutComponent in interface java.awt.LayoutManager2component - the Componentconstraints - the bounding Rectangle
public void addLayoutComponent(java.lang.String s,
java.awt.Component component)
Details: This method is reserved and will throw an exception if used.
addLayoutComponent in interface java.awt.LayoutManagerpublic void removeLayoutComponent(java.awt.Component component)
Details: removeLayoutComponent is called by the target Container when its remove method is called. It removes the indicated Component from this layout mananger's cache of Component/Rectangle bindings.
removeLayoutComponent in interface java.awt.LayoutManagercomponent - the component to removepublic java.awt.Dimension minimumLayoutSize(java.awt.Container target)
Details: minimumLayoutSize returns this layout manager's minimum layout size, as indicated at constrution time.
minimumLayoutSize in interface java.awt.LayoutManagertarget - not usedpublic java.awt.Dimension preferredLayoutSize(java.awt.Container target)
Details: preferredLayoutSize returns this layout manager's preferred layout size, as indicated at constrution time.
preferredLayoutSize in interface java.awt.LayoutManagertarget - not usedpublic java.awt.Dimension maximumLayoutSize(java.awt.Container target)
Details: maximumLayoutSize returns this layout manager's maximum layout size, as indicated at constrution time.
maximumLayoutSize in interface java.awt.LayoutManager2target - not usedpublic void layoutContainer(java.awt.Container target)
Details: This method is called by the target Container when it needs to lay out it's children. This happens when the Container is first initialized, and may also happen when the Container is resized. This method may change the sizes and positions of the Container's children.
layoutContainer in interface java.awt.LayoutManagertarget - the Containerpublic void invalidateLayout(java.awt.Container target)
Details: This method is sometimes called by the parent Container, but it has no effect.
invalidateLayout in interface java.awt.LayoutManager2public float getLayoutAlignmentX(java.awt.Container target)
Details: getLayoutAlignmentX returns alignment information about the entire Container. 0.5 is returned, indicating horizontal centering.
getLayoutAlignmentX in interface java.awt.LayoutManager2public float getLayoutAlignmentY(java.awt.Container target)
Details: getLayoutAlignmentY returns alignment information about the entire Container. 0.5 is returned, indicating vertical centering.
getLayoutAlignmentY in interface java.awt.LayoutManager2
|
Sharkysoft home | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||