public class FlowLayoutCorrectMinimumSize extends FlowLayout
FlowLayout
does
not claim the correct size but chooses the maximum width of all components to
render which is worthless as the fact of flow breaks is not taken into
account.
This class is inspired by the sun class
with modifications to the methods
FlowLayout
and
preferredLayoutSize(Container)
.
minimumLayoutSize(Container)
Constructor and Description |
---|
FlowLayoutCorrectMinimumSize(int align)
Constructs a new
FlowLayout with the specified alignment and
a default 5-unit horizontal and vertical gap. |
FlowLayoutCorrectMinimumSize(int align,
int hgap,
int vgap)
Creates a new flow layout manager with the indicated alignment and the
indicated horizontal and vertical gaps.
|
Modifier and Type | Method and Description |
---|---|
void |
layoutContainer(Container target)
Lays out the container.
|
Dimension |
minimumLayoutSize(Container target)
Returns the minimum dimensions needed to layout the visible
components contained in the specified target container.
|
Dimension |
preferredLayoutSize(Container target)
Returns the preferred dimensions for this layout given the visible
components in the specified target container.
|
addLayoutComponent, getAlignment, getAlignOnBaseline, getHgap, getVgap, removeLayoutComponent, setAlignment, setAlignOnBaseline, setHgap, setVgap, toString
public FlowLayoutCorrectMinimumSize(int align)
FlowLayout
with the specified alignment and
a default 5-unit horizontal and vertical gap. The value of the alignment
argument must be one of FlowLayout.LEFT
,
FlowLayout.RIGHT
, FlowLayout.CENTER
,
FlowLayout.LEADING
, or FlowLayout.TRAILING
.align
- the alignment valuepublic FlowLayoutCorrectMinimumSize(int align, int hgap, int vgap)
The value of the alignment argument must be one of
FlowLayout.LEFT
, FlowLayout.RIGHT
,
FlowLayout.CENTER
, FlowLayout.LEADING
, or
FlowLayout.TRAILING
.
align
- the alignment valuehgap
- the horizontal gap between components and between the components
and the borders of the Container
vgap
- the vertical gap between components and between the components
and the borders of the Container
public void layoutContainer(Container target)
FlowLayout
object.layoutContainer
in interface LayoutManager
layoutContainer
in class FlowLayout
target
- the specified component being laid outContainer
,
Container.doLayout()
public Dimension minimumLayoutSize(Container target)
minimumLayoutSize
in interface LayoutManager
minimumLayoutSize
in class FlowLayout
target
- the container that needs to be laid outpreferredLayoutSize(java.awt.Container)
,
Container
,
Container.doLayout()
public Dimension preferredLayoutSize(Container target)
preferredLayoutSize
in interface LayoutManager
preferredLayoutSize
in class FlowLayout
target
- the container that needs to be laid outContainer
,
minimumLayoutSize(java.awt.Container)
,
Container.getPreferredSize()
Copyright © 2001 - 2010 LGPL, All Rights Footloose.