LayoutStyle
provides information about how to position
components. This class is primarily useful for visual tools and
layout managers. Most developers will not need to use this class.
You typically don't set or create a
LayoutStyle
. Instead use the static method
getInstance
to obtain the current instance.
Modifier and Type | Class and Description |
---|---|
public static enum | LayoutStyle.
|
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public abstract int | Returns: the amount of space to place between the component and specified edgethe component, int JComponent being positionedthe position position, Container component is being placed
relative to its parent; one of
SwingConstants.NORTH ,
SwingConstants.SOUTH ,
SwingConstants.EAST or
SwingConstants.WEST the parent of parent)component ; this may differ
from the actual parent and may be null Returns the amount of space to place between the component and specified edge of its parent. |
public static LayoutStyle | |
public abstract int | Returns: the amount of space to place between the two componentsthe component1, JComponent JComponent
component2 is being placed relative tothe component2, LayoutStyle.JComponent being placedhow the two components are being placed type,the position position, Container component2 is being placed
relative to component1 ; one of
SwingConstants.NORTH ,
SwingConstants.SOUTH ,
SwingConstants.EAST or
SwingConstants.WEST the parent of parent)component2 ; this may differ
from the actual parent and it may be null Returns the amount of space to use between two components. |
public static void |
LayoutStyle | back to summary |
---|---|
public LayoutStyle() Creates a new |
getContainerGap | back to summary |
---|---|
public abstract int getContainerGap(JComponent component, int position, Container parent) Returns the amount of space to place between the component and specified edge of its parent.
|
getInstance | back to summary |
---|---|
public static LayoutStyle getInstance() Returns the shared instance of
|
getPreferredGap | back to summary |
---|---|
public abstract int getPreferredGap(JComponent component1, JComponent component2, LayoutStyle. Returns the amount of space to use between two components.
The return value indicates the distance to place
int gap = getPreferredGap(component1, component2, ComponentPlacement.RELATED, SwingConstants.NORTH, parent);The type parameter indicates the relation between
the two components. If the two components will be contained in
the same parent and are showing similar logically related
items, use RELATED . If the two components will be
contained in the same parent but show logically unrelated items
use UNRELATED . Some look and feels may not
distinguish between the RELATED and
UNRELATED types.
The return value is not intended to take into account the
current size and position of
|
setInstance | back to summary |
---|---|
public static void setInstance(LayoutStyle style) Sets the shared instance of
|
ComponentPlacement
is an enumeration of the
possible ways two components can be placed relative to each
other. ComponentPlacement
is used by the
LayoutStyle
method getPreferredGap
. Refer to
LayoutStyle
for more information.
LayoutStyle#getPreferredGap(JComponent, JComponent, ComponentPlacement, int, Container)
Modifier and Type | Field and Description |
---|---|
public static final LayoutStyle. | INDENT
Enumeration value indicating the distance to indent a component is being requested. |
public static final LayoutStyle. | RELATED
Enumeration value indicating the two components are visually related and will be placed in the same parent. |
public static final LayoutStyle. | UNRELATED
Enumeration value indicating the two components are visually unrelated and will be placed in the same parent. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public static LayoutStyle. | |
public static LayoutStyle. |
INDENT | back to summary |
---|---|
public static final LayoutStyle. Enumeration value indicating the distance to indent a component
is being requested. For example, often times the children of
a label will be horizontally indented from the label. To determine
the preferred distance for such a gap use the
This value is typically only useful with a direction of
|
RELATED | back to summary |
---|---|
public static final LayoutStyle. Enumeration value indicating the two components are
visually related and will be placed in the same parent.
For example, a |
UNRELATED | back to summary |
---|---|
public static final LayoutStyle. Enumeration value indicating the two components are
visually unrelated and will be placed in the same parent.
For example, groupings of components are usually visually
separated; the constant |
ComponentPlacement | back to summary |
---|---|
private ComponentPlacement() |
valueOf | back to summary |
---|---|
public static LayoutStyle. |
values | back to summary |
---|---|
public static LayoutStyle. |