
xy.reflect.ui.resource.jdk-apidocs.javax.swing.LayoutStyle.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reflection-ui Show documentation
Show all versions of reflection-ui Show documentation
Generates automatically the GUI of any Java object
LayoutStyle (Java Platform SE 6)
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Java™ Platform
Standard Ed. 6
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
javax.swing
Class LayoutStyle
java.lang.Object
javax.swing.LayoutStyle
public abstract class LayoutStyle
- extends Object
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.
- Since:
- 1.6
Nested Class Summary | |
---|---|
static class |
LayoutStyle.ComponentPlacement
ComponentPlacement is an enumeration of the
possible ways two components can be placed relative to each
other. |
Constructor Summary | |
---|---|
LayoutStyle()
Creates a new LayoutStyle . |
Method Summary | |
---|---|
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. |
static LayoutStyle |
getInstance()
Returns the shared instance of LayoutStyle . |
abstract int |
getPreferredGap(JComponent component1,
JComponent component2,
LayoutStyle.ComponentPlacement type,
int position,
Container parent)
Returns the amount of space to use between two components. |
static void |
setInstance(LayoutStyle style)
Sets the shared instance of LayoutStyle . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
LayoutStyle
public LayoutStyle()
- Creates a new
LayoutStyle
. You generally don't create aLayoutStyle
. Instead use the methodgetInstance
to obtain the currentLayoutStyle
.
Method Detail |
---|
setInstance
public static void setInstance(LayoutStyle style)
- Sets the shared instance of
LayoutStyle
. Specifyingnull
results in using theLayoutStyle
from the currentLookAndFeel
.- Parameters:
style
- theLayoutStyle
, ornull
- See Also:
getInstance()
getInstance
public static LayoutStyle getInstance()
- Returns the shared instance of
LayoutStyle
. If an instance has not been specified insetInstance
, this will return theLayoutStyle
from the currentLookAndFeel
.- Returns:
- the shared instance of
LayoutStyle
- See Also:
LookAndFeel.getLayoutStyle()
getPreferredGap
public abstract int getPreferredGap(JComponent component1, JComponent component2, LayoutStyle.ComponentPlacement type, int position, Container parent)
- Returns the amount of space to use between two components.
The return value indicates the distance to place
component2
relative tocomponent1
. For example, the following returns the amount of space to place betweencomponent2
andcomponent1
whencomponent2
is placed vertically abovecomponent1
:int gap = getPreferredGap(component1, component2, ComponentPlacement.RELATED, SwingConstants.NORTH, parent);
Thetype
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, useRELATED
. If the two components will be contained in the same parent but show logically unrelated items useUNRELATED
. Some look and feels may not distinguish between theRELATED
andUNRELATED
types.The return value is not intended to take into account the current size and position of
component2
orcomponent1
. The return value may take into consideration various properties of the components. For example, the space may vary based on font size, or the preferred size of the component.- Parameters:
component1
- theJComponent
component2
is being placed relative tocomponent2
- theJComponent
being placedposition
- the positioncomponent2
is being placed relative tocomponent1
; one ofSwingConstants.NORTH
,SwingConstants.SOUTH
,SwingConstants.EAST
orSwingConstants.WEST
type
- how the two components are being placedparent
- the parent ofcomponent2
; this may differ from the actual parent and it may benull
- Returns:
- the amount of space to place between the two components
- Throws:
NullPointerException
- ifcomponent1
,component2
ortype
isnull
IllegalArgumentException
- ifposition
is not one ofSwingConstants.NORTH
,SwingConstants.SOUTH
,SwingConstants.EAST
orSwingConstants.WEST
- Since:
- 1.6
- See Also:
LookAndFeel.getLayoutStyle()
getContainerGap
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.
- Parameters:
component
- theJComponent
being positionedposition
- the positioncomponent
is being placed relative to its parent; one ofSwingConstants.NORTH
,SwingConstants.SOUTH
,SwingConstants.EAST
orSwingConstants.WEST
parent
- the parent ofcomponent
; this may differ from the actual parent and may benull
- Returns:
- the amount of space to place between the component and specified edge
- Throws:
IllegalArgumentException
- ifposition
is not one ofSwingConstants.NORTH
,SwingConstants.SOUTH
,SwingConstants.EAST
orSwingConstants.WEST
|
Java™ Platform Standard Ed. 6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
For further API reference and developer documentation, see Java SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy