|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbb.gui.CenterLayout
public class CenterLayout
This LayoutManager always draws each Component centered inside the target Container, and at its preferred size. Here, "centered" means that the Component's bounding rectangle's center is the same as the center of the Container.
Typically, this LayoutManager will be used for Containers which have only a single Component inside, because multiple Components will get drawn over each other. But if overdrawing is satisfactory or desired, then this LayoutManager is also suitable for Containers with multiple Components inside.
Like typical java gui code, this class is not multithread safe:
it expects to only be called by EventQueue
's dispatch thread
.
Nested Class Summary | |
---|---|
static class |
CenterLayout.UnitTest
See the Overview page of the project's javadocs for a general description of this unit test class. |
Field Summary | |
---|---|
private static long |
serialVersionUID
|
Constructor Summary | |
---|---|
CenterLayout()
Creates a new CenterLayout instance. |
Method Summary | |
---|---|
void |
addLayoutComponent(Component comp,
Object constraints)
Not used by this class (is implemented as an empty method). |
void |
addLayoutComponent(String name,
Component comp)
Not used by this class (is implemented as an empty method). |
float |
getLayoutAlignmentX(Container target)
Returns the alignment along the X axis for the Container. |
float |
getLayoutAlignmentY(Container target)
Returns the alignment along the Y axis for the Container. |
void |
invalidateLayout(Container target)
Not used by this class (is implemented as an empty method). |
void |
layoutContainer(Container target)
Called by the AWT when the specified Container needs to be laid out. |
Dimension |
maximumLayoutSize(Container target)
Returns target.getMaximumSize() . |
Dimension |
minimumLayoutSize(Container target)
Returns the minimum dimensions needed to lay out the components contained in target. |
Dimension |
preferredLayoutSize(Container target)
Returns the preferred dimensions needed to lay out the components contained in target. |
void |
removeLayoutComponent(Component comp)
Not used by this class (is implemented as an empty method). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
Constructor Detail |
---|
public CenterLayout()
Method Detail |
---|
public float getLayoutAlignmentX(Container target)
getLayoutAlignmentX
in interface LayoutManager2
target
- a Container
public float getLayoutAlignmentY(Container target)
getLayoutAlignmentY
in interface LayoutManager2
target
- a Container
public Dimension minimumLayoutSize(Container target)
minimumLayoutSize
in interface LayoutManager
target
- the Container that needs to be laid out
preferredLayoutSize(java.awt.Container)
,
maximumLayoutSize(java.awt.Container)
public Dimension preferredLayoutSize(Container target)
preferredLayoutSize
in interface LayoutManager
target
- the Container that needs to be laid out
minimumLayoutSize(java.awt.Container)
,
maximumLayoutSize(java.awt.Container)
public Dimension maximumLayoutSize(Container target)
target.getMaximumSize()
.
maximumLayoutSize
in interface LayoutManager2
target
- the Container that needs to be laid out
minimumLayoutSize(java.awt.Container)
,
preferredLayoutSize(java.awt.Container)
public void addLayoutComponent(String name, Component comp)
addLayoutComponent
in interface LayoutManager
name
- the name of the componentcomp
- the componentpublic void addLayoutComponent(Component comp, Object constraints)
addLayoutComponent
in interface LayoutManager2
comp
- the componentconstraints
- constraintspublic void invalidateLayout(Container target)
invalidateLayout
in interface LayoutManager2
target
- the affected containerpublic void layoutContainer(Container target)
layoutContainer
in interface LayoutManager
target
- the container to lay outpublic void removeLayoutComponent(Component comp)
removeLayoutComponent
in interface LayoutManager
comp
- the component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |