public class SwingPercentLayoutAdapter extends Object implements LayoutManager2, PercentLayoutPlatformAdapter, Serializable
Implementation of a Swing-specific adapter class for the percent layout manager.
This class implements the percent layout manager for swing. It implements the
LayoutManager2
interface and can be used as a standard Swing
layout.
Constructor and Description |
---|
SwingPercentLayoutAdapter(PercentLayoutBase percentLayout)
Creates a new instance of
SwingPercentLayouAdaptert and sets the
associated percent layout. |
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(Component comp,
Object constraints)
Adds a component to this layout.
|
void |
addLayoutComponent(String name,
Component comp)
Adds a component to this layout manager using the given name as
constraints object.
|
Object |
getComponent(int index)
Returns the component with the given index.
|
int |
getComponentCount()
Returns the number of components in this layout.
|
Object |
getConstraints(int index)
Returns the constraints for the component with the given index.
|
float |
getLayoutAlignmentX(Container container)
Returns the layout alignment in X direction.
|
float |
getLayoutAlignmentY(Container container)
Returns the layout alignment in Y direction.
|
int |
getMinimumComponentSize(Object component,
boolean vert)
Returns the minimum size of the specified component in the given axis.
|
PercentLayoutBase |
getPercentLayout()
Returns a reference to the associated percent layout object.
|
int |
getPreferredComponentSize(Object component,
boolean vert)
Returns the preferred size of the specified component in the given axis.
|
UnitSizeHandler |
getSizeHandler()
Returns the size handler used by this layout.
|
void |
invalidateLayout(Container container)
Invalidates this layout.
|
void |
layoutContainer(Container container)
Determines the coordinates and sizes of all components that belong to
this layout.
|
Dimension |
maximumLayoutSize(Container container)
Returns the maximum layout size.
|
Dimension |
minimumLayoutSize(Container container)
Returns the minimum size of this layout.
|
Dimension |
preferredLayoutSize(Container container)
Returns the preferred size of this layout.
|
void |
removeLayoutComponent(Component c)
Removes the specified component from the layout manager.
|
void |
setComponentBounds(Object component,
Rectangle bounds)
Initializes the bounds for the specified component.
|
public SwingPercentLayoutAdapter(PercentLayoutBase percentLayout)
SwingPercentLayouAdaptert
and sets the
associated percent layout.percentLayout
- the percent layout object (must not be null)IllegalArgumentException
- if the PercentLayoutBase
object
is nullpublic PercentLayoutBase getPercentLayout()
public float getLayoutAlignmentX(Container container)
getLayoutAlignmentX
in interface LayoutManager2
container
- the associated containerpublic float getLayoutAlignmentY(Container container)
getLayoutAlignmentY
in interface LayoutManager2
container
- the associated containerpublic void invalidateLayout(Container container)
invalidateLayout
in interface LayoutManager2
container
- the associated containerpublic Dimension maximumLayoutSize(Container container)
maximumLayoutSize
in interface LayoutManager2
container
- the containerpublic void addLayoutComponent(Component comp, Object constraints)
addLayoutComponent
in interface LayoutManager2
comp
- the component to addconstraints
- the constraintspublic void addLayoutComponent(String name, Component comp)
addLayoutComponent
in interface LayoutManager
name
- the namecomp
- the componentpublic void removeLayoutComponent(Component c)
removeLayoutComponent
in interface LayoutManager
c
- the component to removepublic void layoutContainer(Container container)
layoutContainer
in interface LayoutManager
container
- the associated containerpublic Dimension minimumLayoutSize(Container container)
minimumLayoutSize
in interface LayoutManager
container
- the associated containerpublic Dimension preferredLayoutSize(Container container)
preferredLayoutSize
in interface LayoutManager
container
- the associated containerpublic UnitSizeHandler getSizeHandler()
getSizeHandler
in interface PercentLayoutPlatformAdapter
public int getComponentCount()
getComponentCount
in interface PercentLayoutPlatformAdapter
public Object getComponent(int index)
getComponent
in interface PercentLayoutPlatformAdapter
index
- the indexpublic Object getConstraints(int index)
getConstraints
in interface PercentLayoutPlatformAdapter
index
- the indexpublic int getMinimumComponentSize(Object component, boolean vert)
getMinimumComponentSize
in interface PercentLayoutPlatformAdapter
component
- the componentvert
- the flag for the axispublic int getPreferredComponentSize(Object component, boolean vert)
getPreferredComponentSize
in interface PercentLayoutPlatformAdapter
component
- the componentvert
- the flag for the axispublic void setComponentBounds(Object component, Rectangle bounds)
setComponentBounds
in interface PercentLayoutPlatformAdapter
component
- the componentbounds
- the new boundsCopyright © 2016 The JGUIraffe Team. All rights reserved.