|
Side of Software Print Preview Library 1.8.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sos.preview.ZoomLayout
A layout scheme that scales components a fixed amount. ZoomLayout
arranges
as many scaled child components across the width of the container as possible,
respecting the left margin, right margin, and horizontal spacing constraints.
It scales each child component the same amount. If a child
component has a smaller preferred size, ZoomLayout
uses
the horizontal and vertical alignments to position it relative to the other components.
The following diagram illustrates the placement of child components when at most than one child will not fit in the container's width:
FitAllLayout
,
FitLayout
,
MatrixLayout
,
ScalingLayoutManager
,
ScrollableLayoutManager
Constructor Summary | |
ZoomLayout()
Creates a ZoomLayout with a scale of 1.0 and default alignments and spacing. |
|
ZoomLayout(double scale)
Creates a ZoomLayout with the specified scale and with default
alignments and spacing. |
|
ZoomLayout(double scale,
int horizontalAlignment,
int verticalAlignment)
Creates a ZoomLayout with the specified scale and alignments and with
default spacing. |
|
ZoomLayout(double scale,
int horizontalSpacing,
int verticalSpacing,
int minLeftMargin,
int minRightMargin,
int minTopMargin,
int minBottomMargin)
Creates a ZoomLayout with the specified scale and specified spacing and
with default alignments. |
|
ZoomLayout(double scale,
int horizontalAlignment,
int verticalAlignment,
int horizontalSpacing,
int verticalSpacing,
int minLeftMargin,
int minRightMargin,
int minTopMargin,
int minBottomMargin)
Creates a ZoomLayout with the specified scale, alignments, and spacing. |
Method Summary | |
void |
addLayoutComponent(java.lang.String name,
java.awt.Component component)
If the layout manager uses a per-component string, adds the specified component to the layout, associating it with the specified name. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
java.awt.Dimension |
getPreferredScrollableViewportSize(java.awt.Container container)
Returns the specified container's preferred scrollable viewport size. |
double |
getScale()
Returns this zoom layout's scale. |
int |
getScrollableBlockIncrement(java.awt.Container container,
java.awt.Rectangle rectangle,
int orientation,
int direction)
Returns the specified container's scrollable block increment. |
boolean |
getScrollableTracksViewportHeight(java.awt.Container container)
Returns true if a viewport should always force the height of the
specified container to match the height of the viewport. |
boolean |
getScrollableTracksViewportWidth(java.awt.Container container)
Returns true if a viewport should always force the width of the
specified container to match the width of the viewport. |
int |
getScrollableUnitIncrement(java.awt.Container container,
java.awt.Rectangle rectangle,
int orientation,
int direction)
Returns the specified container's scrollable unit increment. |
int |
hashCode()
Returns a hash code value for the object. |
void |
layoutContainer(java.awt.Container container)
Lays out the specified container. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container container)
Calculates the minimum size dimensions for the specified container, given the components it contains. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container container)
Calculates the preferred size dimensions for the specified container, given the components it contains. |
double |
preferredScale(java.awt.Container container)
Returns the scale of the specified container's components if the container were to get its preferred size. |
void |
removeLayoutComponent(java.awt.Component component)
Removes the specified component from the layout. |
double |
scaleComponents(java.awt.Container container)
Lays out the container's components and returns the scale factor. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ZoomLayout()
ZoomLayout
with a scale of 1.0 and default alignments and spacing.
ZoomLayout(double,int,int,int,int,int,int,int,int)
public ZoomLayout(double scale) throws java.lang.IllegalArgumentException
ZoomLayout
with the specified scale and with default
alignments and spacing.
scale
- amount to scale a container's components
java.lang.IllegalArgumentException
- if scale <= 0.0
ZoomLayout(double,int,int,int,int,int,int,int,int)
public ZoomLayout(double scale, int horizontalAlignment, int verticalAlignment) throws java.lang.IllegalArgumentException
ZoomLayout
with the specified scale and alignments and with
default spacing.
scale
- amount to scale a container's componentshorizontalAlignment
- Horizontal alignment of components that are
not as wide as the widest component in the container. Acceptable values
are SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.RIGHT,
SwingConstants.LEADING, and SwingConstants.TRAILING.verticalAlignment
- Vertical alignment of components that are
not as tall as the tallest component in the container. Acceptable values
are SwingConstants.CENTER, SwingConstants.TOP, and SwingConstants.BOTTOM.
java.lang.IllegalArgumentException
- if scale <= 0.0
or if one of the alignment parameters is an unacceptable SwingConstant
ZoomLayout(double,int,int,int,int,int,int,int,int)
public ZoomLayout(double scale, int horizontalSpacing, int verticalSpacing, int minLeftMargin, int minRightMargin, int minTopMargin, int minBottomMargin) throws java.lang.IllegalArgumentException
ZoomLayout
with the specified scale and specified spacing and
with default alignments.
scale
- amount to scale a container's componentshorizontalSpacing
- Horizontal spacing between componentsverticalSpacing
- Vertical spacing between componentsminLeftMargin
- Minimum left marginminRightMargin
- Minimum right marginminTopMargin
- Minimum top marginminBottomMargin
- Minimum bottom margin
java.lang.IllegalArgumentException
- if scale <= 0.0
or if one of the spacing parameters is negativeZoomLayout(double,int,int,int,int,int,int,int,int)
public ZoomLayout(double scale, int horizontalAlignment, int verticalAlignment, int horizontalSpacing, int verticalSpacing, int minLeftMargin, int minRightMargin, int minTopMargin, int minBottomMargin) throws java.lang.IllegalArgumentException
ZoomLayout
with the specified scale, alignments, and spacing.
scale
- amount to scale a container's componentshorizontalAlignment
- Horizontal alignment of components that are
not as wide as the widest component in the container. Acceptable values
are SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.RIGHT,
SwingConstants.LEADING, and SwingConstants.TRAILING.verticalAlignment
- Vertical alignment of components that are
not as tall as the tallest component in the container. Acceptable values
are SwingConstants.CENTER, SwingConstants.TOP, and SwingConstants.BOTTOM.horizontalSpacing
- Horizontal spacing between componentsverticalSpacing
- Vertical spacing between componentsminLeftMargin
- Minimum left marginminRightMargin
- Minimum right marginminTopMargin
- Minimum top marginminBottomMargin
- Minimum bottom margin
java.lang.IllegalArgumentException
- if scale <= 0.0
,
if one of the alignment parameters is an unacceptable SwingConstant
,
or if one of the spacing parameters is negativeMethod Detail |
public void addLayoutComponent(java.lang.String name, java.awt.Component component)
addLayoutComponent
in interface java.awt.LayoutManager
name
- the string to be associated with the componentcomponent
- the component to be addedpublic java.awt.Dimension getPreferredScrollableViewportSize(java.awt.Container container)
ScrollableLayoutManager
javax.swing.Scrollable#getPreferredScrollableViewportSize
,
except the container is a parameter instead of the receiver.
getPreferredScrollableViewportSize
in interface ScrollableLayoutManager
container
- Container for which the preferred size is requested
container
public double preferredScale(java.awt.Container container)
ScalingLayoutManager
preferredScale
in interface ScalingLayoutManager
container
- container for which to calculate the scale
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare
true
if this object is the same as obj
public double getScale()
public int getScrollableBlockIncrement(java.awt.Container container, java.awt.Rectangle rectangle, int orientation, int direction)
ScrollableLayoutManager
javax.swing.Scrollable#getScrollableBlockIncrement
,
except the container is a parameter instead of the receiver.
getScrollableBlockIncrement
in interface ScrollableLayoutManager
container
- The container that is being scrolledrectangle
- The view area visible within the viewportorientation
- The axis of the scrolling--either
SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
direction
- A negative number to indicate scrolling left or up, or
a positive number to indicate scrolling right or down
public boolean getScrollableTracksViewportHeight(java.awt.Container container)
ScrollableLayoutManager
true
if a viewport should always force the height of the
specified container to match the height of the viewport.
The semantics are the same as
javax.swing.Scrollable#getScrollableTracksViewportHeight
,
except the container is a parameter instead of the receiver.
getScrollableTracksViewportHeight
in interface ScrollableLayoutManager
container
- The container in question
true
if a viewport should keep the
container
's height the same height of the viewportpublic boolean getScrollableTracksViewportWidth(java.awt.Container container)
ScrollableLayoutManager
true
if a viewport should always force the width of the
specified container to match the width of the viewport.
The semantics are the same as
javax.swing.Scrollable#getScrollableTracksViewportWidth
,
except the container is a parameter instead of the receiver.
getScrollableTracksViewportWidth
in interface ScrollableLayoutManager
container
- The container in question
true
if a viewport should keep the
container
's width the same width of the viewportpublic int getScrollableUnitIncrement(java.awt.Container container, java.awt.Rectangle rectangle, int orientation, int direction)
ScrollableLayoutManager
javax.swing.Scrollable#getScrollableUnitIncrement
,
except the container is a parameter instead of the receiver.
getScrollableUnitIncrement
in interface ScrollableLayoutManager
container
- The container that is being scrolledrectangle
- The view area visible within the viewportorientation
- The axis of the scrolling--either
SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
direction
- A negative number to indicate scrolling left or up, or
a positive number to indicate scrolling right or down
public int hashCode()
hashCode
in class java.lang.Object
public void layoutContainer(java.awt.Container container)
layoutContainer
in interface java.awt.LayoutManager
container
- the container to be laid outpublic double scaleComponents(java.awt.Container container)
ScalingLayoutManager
scaleComponents
in interface ScalingLayoutManager
container
- container for which to lay out its children
public java.awt.Dimension minimumLayoutSize(java.awt.Container container)
minimumLayoutSize
in interface java.awt.LayoutManager
container
- the container to be laid out
container
public java.awt.Dimension preferredLayoutSize(java.awt.Container container)
preferredLayoutSize
in interface java.awt.LayoutManager
container
- the container to be laid out
container
public void removeLayoutComponent(java.awt.Component component)
removeLayoutComponent
in interface java.awt.LayoutManager
component
- the component to be removed
|
Side of Software Print Preview Library 1.8.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |