|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjavax.swing.LayoutStyle
public abstract class LayoutStyle
LayoutStyle は、コンポーネントの配置に関する情報を提供します。このクラスは、主にビジュアルツールとレイアウトマネージャーで使用されます。ほとんどの場合、開発者がこのクラスを使用する必要はありません。
通常、LayoutStyle の設定や作成は行いません。代わりに、static メソッド getInstance を使って現在のインスタンスを取得します。
| 入れ子のクラスの概要 | |
|---|---|
static class |
LayoutStyle.ComponentPlacement
ComponentPlacement は、2 つのコンポーネントを相互に関連付けて配置する場合に使用できる方法の列挙です。 |
| コンストラクタの概要 | |
|---|---|
LayoutStyle()
新しい LayoutStyle を作成します。 |
|
| メソッドの概要 | |
|---|---|
abstract int |
getContainerGap(JComponent component,
int position,
Container parent)
コンポーネントからその親の指定された端までのスペースの量を返します。 |
static LayoutStyle |
getInstance()
LayoutStyle の共有インスタンスを返します。 |
abstract int |
getPreferredGap(JComponent component1,
JComponent component2,
LayoutStyle.ComponentPlacement type,
int position,
Container parent)
2 つのコンポーネント間のスペースの量を返します。 |
static void |
setInstance(LayoutStyle style)
LayoutStyle の共有インスタンスを設定します。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| コンストラクタの詳細 |
|---|
public LayoutStyle()
LayoutStyle を作成します。通常、LayoutStyle は作成しません。代わりに、getInstance メソッド を使って現在の LayoutStyle を取得します。
| メソッドの詳細 |
|---|
public static void setInstance(LayoutStyle style)
LayoutStyle の共有インスタンスを設定します。null を指定すると、現在の LookAndFeel の LayoutStyle が使用されます。
style - LayoutStyle または nullgetInstance()public static LayoutStyle getInstance()
LayoutStyle の共有インスタンスを返します。setInstance でインスタンスが指定されていない場合は、現在の LookAndFeel の LayoutStyle が返されます。
LayoutStyle の共有インスタンスLookAndFeel.getLayoutStyle()
public abstract int getPreferredGap(JComponent component1,
JComponent component2,
LayoutStyle.ComponentPlacement type,
int position,
Container parent)
component1 を基準とした component2 の配置距離を表します。たとえば、次のコードは、component2 を component1 の上方に配置するときの component2 と component1 の間の距離を返します。
int gap = getPreferredGap(component1, component2,
ComponentPlacement.RELATED,
SwingConstants.NORTH, parent);
type パラメータは、2 つのコンポーネントの関係を示します。2 つのコンポーネントが同じ親を持ち、論理的に関連性のあるよく似た項目を表示している場合、RELATED を使用します。2 つのコンポーネントの親が同じであっても、論理的に関連性のない項目を表示している場合は、UNRELATED を使用します。RELATED タイプと UNRELATED タイプの Look & Feel の違いを区別できない場合もあります。
戻り値では、component2 または component1 の現在のサイズと位置が考慮されません。戻り値で、コンポーネントのさまざまなプロパティーが考慮されることがあります。たとえば、スペースは、フォントサイズやコンポーネントの適切なサイズによって異なる可能性があります。
component1 - component2 を配置するとき基準にする
JComponentcomponent2 - 配置される JComponentposition - component1 を基準とした
component2 の配置位置。
SwingConstants.NORTH、
SwingConstants.SOUTH、
SwingConstants.EAST、または
SwingConstants.WESTtype - 2 つのコンポーネントの配置方法parent - component2 の親。
実際の親とは異なる可能性がある。また、null の可能性もある
NullPointerException - component1、
component2、または type が
null
IllegalArgumentException - position が次のいずれでもない場合。
SwingConstants.NORTH、
SwingConstants.SOUTH、
SwingConstants.EAST、または
SwingConstants.WESTLookAndFeel.getLayoutStyle()
public abstract int getContainerGap(JComponent component,
int position,
Container parent)
component - 配置される JComponentposition - 親を基準とした component
の配置位置。
SwingConstants.NORTH、
SwingConstants.SOUTH、
SwingConstants.EAST、または
SwingConstants.WESTparent - component の親。
実際の親とは異なる可能性がある。また、null の可能性もある
IllegalArgumentException - position が次のいずれでもない場合。
SwingConstants.NORTH、
SwingConstants.SOUTH、
SwingConstants.EAST、または
SwingConstants.WEST
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。