class PercentLayout extends Object implements LayoutManager2
Modifier and Type | Class and Description |
---|---|
(package private) static class |
PercentLayout.Constraint |
(package private) static class |
PercentLayout.NumberConstraint |
(package private) static class |
PercentLayout.PercentConstraint |
Modifier and Type | Field and Description |
---|---|
private int |
gap |
static int |
HORIZONTAL
Useful constant to layout the components horizontally (from top to
bottom).
|
private Hashtable |
m_ComponentToConstraint |
private int |
orientation |
private static PercentLayout.Constraint |
PREFERRED_SIZE |
private static PercentLayout.Constraint |
REMAINING_SPACE |
static int |
VERTICAL
Useful constant to layout the components vertically (from left to right).
|
Constructor and Description |
---|
PercentLayout()
Creates a new HORIZONTAL PercentLayout with a gap of 0.
|
PercentLayout(int orientation,
int gap) |
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(Component component,
Object constraints) |
void |
addLayoutComponent(String name,
Component comp)
Adds the specified component with the specified name to the layout.
|
PercentLayout.Constraint |
getConstraint(Component component) |
int |
getGap() |
float |
getLayoutAlignmentX(Container target)
Returns the alignment along the x axis.
|
float |
getLayoutAlignmentY(Container target)
Returns the alignment along the y axis.
|
int |
getOrientation() |
void |
invalidateLayout(Container target)
Invalidates the layout, indicating that if the layout manager has cached
information net should be discarded.
|
void |
layoutContainer(Container parent) |
Dimension |
maximumLayoutSize(Container parent)
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) |
void |
removeLayoutComponent(Component comp)
Removes the specified component from the layout.
|
void |
setConstraint(Component component,
Object constraints) |
void |
setGap(int gap) |
void |
setOrientation(int orientation) |
public static final int HORIZONTAL
public static final int VERTICAL
private static final PercentLayout.Constraint REMAINING_SPACE
private static final PercentLayout.Constraint PREFERRED_SIZE
private int orientation
private int gap
private Hashtable m_ComponentToConstraint
public PercentLayout()
public PercentLayout(int orientation, int gap)
public void setGap(int gap)
public int getGap()
public void setOrientation(int orientation)
public int getOrientation()
public PercentLayout.Constraint getConstraint(Component component)
public void addLayoutComponent(Component component, Object constraints)
addLayoutComponent
in interface LayoutManager2
public float getLayoutAlignmentX(Container target)
getLayoutAlignmentX
in interface LayoutManager2
public float getLayoutAlignmentY(Container target)
getLayoutAlignmentY
in interface LayoutManager2
public void invalidateLayout(Container target)
invalidateLayout
in interface LayoutManager2
public void addLayoutComponent(String name, Component comp)
addLayoutComponent
in interface LayoutManager
name
- the component namecomp
- the component to be addedpublic void removeLayoutComponent(Component comp)
removeLayoutComponent
in interface LayoutManager
comp
- the component ot be removedpublic Dimension minimumLayoutSize(Container parent)
minimumLayoutSize
in interface LayoutManager
parent
- the component to be laid outpreferredLayoutSize(java.awt.Container)
public Dimension maximumLayoutSize(Container parent)
maximumLayoutSize
in interface LayoutManager2
Component.getMinimumSize()
,
Component.getPreferredSize()
,
LayoutManager
public Dimension preferredLayoutSize(Container parent)
preferredLayoutSize
in interface LayoutManager
public void layoutContainer(Container parent)
layoutContainer
in interface LayoutManager
Copyright © 2014 www.staniscia.net. All Rights Reserved.