public class PercentageLayout extends Object implements LayoutManager2
add( component1, new Integer( 150)); add( component2, new Integer( 50)); | Modifier and Type | Field and Description |
|---|---|
static int |
HORIZONTAL
Sets the layout orientation to horizontal.
|
static int |
VERTICAL
Sets the layout orientation to vertical.
|
| Constructor and Description |
|---|
PercentageLayout()
Constructs a default PercentageLayout without a gap and with
a horizontal orientation.
|
PercentageLayout(int orientation)
Constructs a PercentageLayout with the orientation supplied
and with no gap between the components.
|
PercentageLayout(int orientation,
int gap)
Constructs a PercentageLayout with the gap and orientation
supplied.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLayoutComponent(Component component,
Object constraints)
Adds the specified component to the layout, using the specified
constraint object.
|
void |
addLayoutComponent(String name,
Component comp)
Not used, components cannot be added without a constraint.
|
int |
getGap()
Returns the gap between the components.
|
float |
getLayoutAlignmentX(Container target)
Returns the alignment along the x axis.
|
float |
getLayoutAlignmentY(Container target)
Returns the alignment along the y axis.
|
int |
getOrientation()
Returns the orientation of the layout manager.
|
void |
invalidateLayout(Container target)
Invalidates the layout, indicating that if the layout manager
has cached information it should be discarded.
|
void |
layoutContainer(Container parent)
Lays out the components on the specified container.
|
Dimension |
maximumLayoutSize(Container target)
Returns the maximum size of this component.
|
Dimension |
minimumLayoutSize(Container parent)
Calculates the minimum size dimensions for the specified
panel given the components in the specified parent container.
|
Dimension |
preferredLayoutSize(Container parent)
Calculates the preferred size dimensions for the specified
container given the components in the specified parent container.
|
void |
removeLayoutComponent(Component component)
Removes the specified component and constraints from the layout.
|
void |
setConstraints(Component component,
Object constraint)
Adds the specified component to the layout, using the specified
constraint object.
|
void |
setGap(int gap)
Sets the gap between the components.
|
void |
setOrientation(int orientation)
Sets the orientation of the layout manager.
|
public static final int HORIZONTAL
public static final int VERTICAL
public PercentageLayout()
public PercentageLayout(int orientation)
orientation - the orientation of the components.public PercentageLayout(int orientation,
int gap)
orientation - the orientation of the components.gap - the space between the components.public int getGap()
public void setGap(int gap)
gap - the gap.public int getOrientation()
public void setOrientation(int orientation)
orientation - the orientation.public void setConstraints(Component component, Object constraint)
component - the component added to the parent container.constraint - the constraint for the added component.public void removeLayoutComponent(Component component)
removeLayoutComponent in interface LayoutManagercomponent - the component to be removedpublic Dimension preferredLayoutSize(Container parent)
preferredLayoutSize in interface LayoutManagerparent - the component to be laid out.public Dimension minimumLayoutSize(Container parent)
minimumLayoutSize in interface LayoutManagerparent - the component to be laid outpublic void layoutContainer(Container parent)
layoutContainer in interface LayoutManagerparent - the component which needs to be laid outpublic void addLayoutComponent(Component component, Object constraints)
addLayoutComponent in interface LayoutManager2component - the component to be addedconstraints - where/how the component is added to the layout.public Dimension maximumLayoutSize(Container target)
maximumLayoutSize in interface LayoutManager2target - the component to be laid outComponent.getMinimumSize(),
Component.getPreferredSize()public float getLayoutAlignmentX(Container target)
getLayoutAlignmentX in interface LayoutManager2target - the container to calculate X alignment for.public float getLayoutAlignmentY(Container target)
getLayoutAlignmentY in interface LayoutManager2target - the container to calculate Y alignment for.public void invalidateLayout(Container target)
invalidateLayout in interface LayoutManager2target - the container.public void addLayoutComponent(String name, Component comp)
addLayoutComponent in interface LayoutManagername - the component name.comp - the component.Copyright © 2002-2013 Edwin Dankert. All Rights Reserved.