Class Overview
Extends the FlowLayout class to support both vertical and horizontal
layout of components. Orientation can be changed dynamically after
creation by calling either of the methods @method orientHorizontally or
Summary
Constants |
int |
BOTTOM |
The bottom vertical alignment constant. |
int |
HORIZONTAL |
The horizontal orientation constant. |
int |
TOP |
The top vertical alignment constant. |
int |
VERTICAL |
The vertical orientation constant. |
[Expand]
Inherited Constants |
From class
java.awt.FlowLayout
int |
CENTER |
This value indicates that each row of components
should be centered. |
int |
LEADING |
This value indicates that each row of components
should be justified to the leading edge of the container's
orientation, for example, to the left in left-to-right orientations. |
int |
LEFT |
This value indicates that each row of components
should be left-justified. |
int |
RIGHT |
This value indicates that each row of components
should be right-justified. |
int |
TRAILING |
This value indicates that each row of components
should be justified to the trailing edge of the container's
orientation, for example, to the right in left-to-right orientations. |
|
Public Constructors |
|
OrientableFlowLayout()
Constructs a new flow layout with a horizontal orientation and
centered alignment.
|
|
OrientableFlowLayout(int orientation)
Constructs a new flow layout with the specified orientation and
a centered alignment.
|
|
OrientableFlowLayout(int orientation, int hAlign, int vAlign)
Constructs a new flow layout with the specified orientation and
alignment.
|
|
OrientableFlowLayout(int orientation, int hAlign, int vAlign, int hHGap, int hVGap, int vHGap, int vVGap)
Constructs a new flow layout with the specified orientation,
alignment, and gap values.
|
[Expand]
Inherited Methods |
From class
java.awt.FlowLayout
void
|
addLayoutComponent(String name, Component comp)
Adds the specified component to the layout.
|
boolean
|
getAlignOnBaseline()
Returns true if components are to be vertically aligned along
their baseline.
|
int
|
getAlignment()
Gets the alignment for this layout.
|
int
|
getHgap()
Gets the horizontal gap between components
and between the components and the borders
of the Container
|
int
|
getVgap()
Gets the vertical gap between components and
between the components and the borders of the
Container .
|
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.
|
void
|
removeLayoutComponent(Component comp)
Removes the specified component from the layout.
|
void
|
setAlignOnBaseline(boolean alignOnBaseline)
Sets whether or not components should be vertically aligned along their
baseline.
|
void
|
setAlignment(int align)
Sets the alignment for this layout.
|
void
|
setHgap(int hgap)
Sets the horizontal gap between components and
between the components and the borders of the
Container .
|
void
|
setVgap(int vgap)
Sets the vertical gap between components and between
the components and the borders of the Container .
|
String
|
toString()
Returns a string representation of this FlowLayout
object and its values.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
From interface
java.awt.LayoutManager
|
Constants
public
static
final
int
BOTTOM
The bottom vertical alignment constant.
Constant Value:
2
(0x00000002)
public
static
final
int
HORIZONTAL
The horizontal orientation constant.
Constant Value:
0
(0x00000000)
public
static
final
int
TOP
The top vertical alignment constant.
Constant Value:
0
(0x00000000)
public
static
final
int
VERTICAL
The vertical orientation constant.
Constant Value:
1
(0x00000001)
Public Constructors
public
OrientableFlowLayout
()
Constructs a new flow layout with a horizontal orientation and
centered alignment.
public
OrientableFlowLayout
(int orientation)
Constructs a new flow layout with the specified orientation and
a centered alignment.
Parameters
orientation
| the orientation, one of HORIZONTAL or VERTICAL.
|
public
OrientableFlowLayout
(int orientation, int hAlign, int vAlign)
Constructs a new flow layout with the specified orientation and
alignment.
Parameters
orientation
| the orientation, one of HORIZONTAL or VERTICAL. |
hAlign
| the horizontal alignment, one of LEFT, CENTER, or RIGHT. |
vAlign
| the vertical alignment, one of TOP, CENTER, or BOTTOM.
|
public
OrientableFlowLayout
(int orientation, int hAlign, int vAlign, int hHGap, int hVGap, int vHGap, int vVGap)
Constructs a new flow layout with the specified orientation,
alignment, and gap values.
Parameters
orientation
| the orientation, one of HORIZONTAL or VERTICAL. |
hAlign
| the horizontal alignment, one of LEFT, CENTER, or RIGHT. |
vAlign
| the vertical alignment, one of TOP, CENTER, or BOTTOM. |
hHGap
| the horizontal gap between components in HORIZONTAL. |
hVGap
| the vertical gap between components in HORIZONTAL. |
vHGap
| the horizontal gap between components in VERTICAL. |
vVGap
| the vertical gap between components in VERTICAL.
|
Public Methods
public
void
layoutContainer
(Container target)
Lays out the container. This method will reshape the
components in the target to satisfy the constraints of the
layout.
Parameters
target
| the specified component being laid out. |
Returns the minimum dimensions needed to layout the components
contained in the specified target container.
Parameters
target
| the component which needs to be laid out. |
Returns
- the minimum dimensions to lay out the
subcomponents of the specified container
public
synchronized
void
orientHorizontally
()
Set the layout's current orientation to horizontal.
public
synchronized
void
orientVertically
()
Set the layout's current orientation to vertical.
public
Dimension
preferredLayoutSize
(Container target)
Returns the preferred dimensions for this layout given the
components in the specified target container.
Parameters
target
| the component which needs to be laid out. |
Returns
- the preferred dimensions to lay out the
subcomponents of the specified container
public
String
toString
()
Returns the String representation of this layout's values.
Returns
- a string representation of this layout