java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.OptionPaneUI
javax.swing.plaf.basic.BasicOptionPaneUI
- 直系の既知のサブクラス:
SynthOptionPaneUI
public class BasicOptionPaneUI extends OptionPaneUI
JOptionPaneの基本Look & Feelを提供します。 BasicMessagePaneUIは、Containerにアイコン、メッセージ、およびボタンを配置する手段を提供します。 一般に、配置は次のようになります。
------------------
| i | message |
| c | message |
| o | message |
| n | message |
------------------
| buttons |
|________________|
アイコンは、JLabelの内部にラップされているIconのインスタンスです。 メッセージは不透明なオブジェクトで、次のようにテストされます: メッセージがComponentの場合、Containerに追加されています。Iconの場合、JLabelの内部にラップされてから、Containerに追加されています。それ以外の場合は、JLabelの内部にラップされています。
オプション・ペインのComponentOrientationプロパティが水平(左から右)のときは、上記の配置が使用されます。 ほかの方向の場合、配置は適切に調節されます。
Container、メッセージ、アイコン、およびボタンは、すべてabstractメソッドで決定されます。
-
ネストされたクラスのサマリー
ネストされたクラス 修飾子と型 クラス 説明 classBasicOptionPaneUI.ButtonActionListenerこのクラスは、「protected」内部クラスとして扱うようにしてください。static classBasicOptionPaneUI.ButtonAreaLayoutButtonAreaLayoutは、FlowLayoutと同様に動作します。classBasicOptionPaneUI.PropertyChangeHandlerこのクラスは、「protected」内部クラスとして扱うようにしてください。 -
フィールドのサマリー
フィールド 修飾子と型 フィールド 説明 protected booleanhasCustomComponentsComponentがメッセージまたはボタンに含まれる場合に、validateComponentでtrueに設定されます。protected ComponentinitialFocusComponentselectInitialValueでメッセージが送られたときに、フォーカスを受け取るコンポーネントです。protected JComponentinputComponentoptionPane.getWantsInput()がtrueを返す場合に、JComponentが入力を用意します。static intMinimumHeightJOptionPaneの最小値。protected DimensionminimumSizeJOptionPaneのサイズ。static intMinimumWidthJOptionPaneの最小幅。protected JOptionPaneoptionPaneレシーバがLook & Feelを提供しているJOptionPaneです。protected PropertyChangeListenerpropertyChangeListenerPropertyChangeListenerのインスタンス。 -
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 BasicOptionPaneUI() -
メソッドのサマリー
修飾子と型 メソッド 説明 protected voidaddButtonComponents(Container container, Object[] buttons, int initialIndex)buttons内の各オブジェクトを表す適切なオブジェクトを作成し、それをcontainerに追加します。protected voidaddIcon(Container top)getIconから返されたアイコンを表すJLabelを作成して、topに追加します。protected voidaddMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)msgを表す適切なオブジェクトを作成し、それをcontainerに配置します。protected voidburstStringInto(Container c, String d, int maxll)dを表す新しいJLabelインスタンスを再帰的に作成します。booleancontainsCustomComponents(JOptionPane op)validateComponentへの直前の呼出しでメッセージまたはボタンがComponentのサブクラスを含んでいた場合に、trueを返します。protected ActionListenercreateButtonActionListener(int buttonIndex)ButtonActionListenerの新しいインスタンスを構築します。protected ContainercreateButtonArea()ボタンを含むContainerを作成して返します。protected LayoutManagercreateLayoutManager()レイアウト・マネージャを返します。protected ContainercreateMessageArea()メッセージの本文を含むContainerを作成するためにinstallComponentsからメッセージされます。protected PropertyChangeListenercreatePropertyChangeListener()PropertyChangeListenerのインスタンスを返します。protected ContainercreateSeparator()セパレータを返します。static ComponentUIcreateUI(JComponent x)新しいBasicOptionPaneUIインスタンスを作成します。protected Object[]getButtons()レシーバがルック・アンド・フィールを提供しているJOptionPaneから表示するボタンを返します。protected IcongetIcon()レシーバがルック・アンド・フィールを提供しているJOptionPaneからのアイコン、またはgetDefaultIconから返されたデフォルトのアイコンを返します。protected IcongetIconForType(int messageType)渡されたタイプに使用するアイコンを返します。protected intgetInitialValueIndex()選択するボタンへの初期インデックスを返します。protected intgetMaxCharactersPerLineCount()1行に配置する最大文字数を返します。protected ObjectgetMessage()レシーバがルック・アンド・フィールを提供しているJOptionPaneから表示するメッセージを返します。DimensiongetMinimumOptionPaneSize()オプション・ペインの最小サイズを返します。DimensiongetPreferredSize(JComponent c)cが、レシーバが含まれるJOptionPaneである場合、返される推奨サイズはJOptionPaneのLayoutManagerの推奨サイズの最大値とgetMinimumOptionPaneSizeです。protected booleangetSizeButtonsToSameWidth()戻り値true、基本L&Fは、すべてのボタンが同じ幅になるようにします。protected voidinstallComponents()コンポーネントを登録します。protected voidinstallDefaults()デフォルトのプロパティをインストールします。protected voidinstallKeyboardActions()キーボード・アクションを登録します。protected voidinstallListeners()リスナーを登録します。voidinstallUI(JComponent c)渡されたJOptionPaneのL&Fとしてレシーバをインストールします。protected voidresetInputValue()レシーバがLook & Feelを提供しているオプション・ペイン内の入力値を、inputComponentの値を基にして設定します。voidselectInitialValue(JOptionPane op)inputComponentがnullでない場合、フォーカスがそれで要求されます。そうでない場合は、フォーカスをデフォルト値で要求します。protected voiduninstallComponents()コンポーネントの登録を解除します。protected voiduninstallDefaults()デフォルト・プロパティをアンインストールします。protected voiduninstallKeyboardActions()キーボード・アクションを登録解除します。protected voiduninstallListeners()リスナーの登録を解除します。voiduninstallUI(JComponent c)渡された分割ペインのL&Fコントローラから、レシーバを削除します。クラス javax.swing.plaf.ComponentUIで宣言されたメソッド
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, paint, update
-
フィールド詳細
-
MinimumWidth
public static final int MinimumWidthJOptionPaneの最小幅。- 関連項目:
- 定数フィールド値
-
MinimumHeight
public static final int MinimumHeightJOptionPaneの最小値。- 関連項目:
- 定数フィールド値
-
optionPane
protected JOptionPane optionPaneレシーバがLook & Feelを提供しているJOptionPaneです。 -
minimumSize
protected Dimension minimumSizeJOptionPaneのサイズ。 -
inputComponent
protected JComponent inputComponentoptionPane.getWantsInput()がtrueを返す場合に、JComponentが入力を用意します。 -
initialFocusComponent
protected Component initialFocusComponentselectInitialValueでメッセージが送られたときに、フォーカスを受け取るコンポーネントです。 -
hasCustomComponents
protected boolean hasCustomComponentsComponentがメッセージまたはボタンに含まれる場合に、validateComponentでtrueに設定されます。 -
propertyChangeListener
protected PropertyChangeListener propertyChangeListenerPropertyChangeListenerのインスタンス。
-
-
コンストラクタの詳細
-
BasicOptionPaneUI
public BasicOptionPaneUI()
-
-
メソッドの詳細
-
createUI
public static ComponentUI createUI(JComponent x)新しいBasicOptionPaneUIインスタンスを作成します。- パラメータ:
x- コンポーネント- 戻り値:
- 新しい
BasicOptionPaneUIインスタンス
-
installUI
public void installUI(JComponent c)渡されたJOptionPaneのL&Fとしてレシーバをインストールします。- オーバーライド:
installUI、クラス:ComponentUI- パラメータ:
c- UI委譲がインストールされるコンポーネント- 関連項目:
ComponentUI.uninstallUI(javax.swing.JComponent),JComponent.setUI(javax.swing.plaf.ComponentUI),JComponent.updateUI()
-
uninstallUI
public void uninstallUI(JComponent c)渡された分割ペインのL&Fコントローラから、レシーバを削除します。- オーバーライド:
uninstallUI、クラス:ComponentUI- パラメータ:
c- このUI委譲が削除されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがある- 関連項目:
ComponentUI.installUI(javax.swing.JComponent),JComponent.updateUI()
-
installDefaults
protected void installDefaults()デフォルトのプロパティをインストールします。 -
uninstallDefaults
protected void uninstallDefaults()デフォルト・プロパティをアンインストールします。 -
installComponents
protected void installComponents()コンポーネントを登録します。 -
uninstallComponents
protected void uninstallComponents()コンポーネントの登録を解除します。 -
createLayoutManager
protected LayoutManager createLayoutManager()レイアウト・マネージャを返します。- 戻り値:
- レイアウト・マネージャ
-
installListeners
protected void installListeners()リスナーを登録します。 -
uninstallListeners
protected void uninstallListeners()リスナーの登録を解除します。 -
createPropertyChangeListener
protected PropertyChangeListener createPropertyChangeListener()PropertyChangeListenerのインスタンスを返します。- 戻り値:
PropertyChangeListenerのインスタンス
-
installKeyboardActions
protected void installKeyboardActions()キーボード・アクションを登録します。 -
uninstallKeyboardActions
protected void uninstallKeyboardActions()キーボード・アクションを登録解除します。 -
getMinimumOptionPaneSize
public Dimension getMinimumOptionPaneSize()オプション・ペインの最小サイズを返します。 主に、異なる最小サイズを提供しようとするサブクラスのために提供されています。- 戻り値:
- オプション・ペインの最小サイズ
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)cが、レシーバが含まれるJOptionPaneである場合、返される推奨サイズはJOptionPaneのLayoutManagerの推奨サイズの最大値とgetMinimumOptionPaneSizeです。- オーバーライド:
getPreferredSize、クラス:ComponentUI- パラメータ:
c- 適切なサイズが照会されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがある- 戻り値:
- Look&Feelに適した指定されたコンポーネントの優先サイズを含む
Dimensionオブジェクト - 関連項目:
JComponent.getPreferredSize(),LayoutManager.preferredLayoutSize(java.awt.Container)
-
createMessageArea
protected Container createMessageArea()メッセージの本文を含むContainerを作成するためにinstallComponentsからメッセージされます。 アイコンは、addIconを呼び出すことにより作成されます。- 戻り値:
Containerのインスタンス
-
addMessageComponents
protected void addMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)msgを表す適切なオブジェクトを作成し、それをcontainerに配置します。msgがComponentのインスタンスである場合、それは直接追加されます。Iconの場合は、それを表すJLabelが作成されます。それ以外の場合は、その文字列に対してJLabelが作成されます。msgがObject []の場合、このメソッドは子に対して再帰的に呼び出されます。msgがComponentのインスタンスであり、このメソッド(これは、internallyCreatedがfalseの場合にのみhasCustomComponentsを正しく設定するために使用されます)によって内部的に作成された場合、internallyCreatedはtrueです。- パラメータ:
container- コンテナcons-GridBagConstraintsのインスタンスmsg- メッセージmaxll- 最大長internallyCreated- コンポーネントが内部的に作成された場合はtrue
-
getMessage
protected Object getMessage()レシーバがルック・アンド・フィールを提供しているJOptionPaneから表示するメッセージを返します。- 戻り値:
- 表示するメッセージ
-
addIcon
protected void addIcon(Container top)getIconから返されたアイコンを表すJLabelを作成して、topに追加します。 これは、createMessageAreaからメッセージとして送られます。- パラメータ:
top- コンテナ
-
getIcon
protected Icon getIcon()レシーバがルック・アンド・フィールを提供しているJOptionPaneからのアイコン、またはgetDefaultIconから返されたデフォルトのアイコンを返します。- 戻り値:
- アイコン
-
getIconForType
protected Icon getIconForType(int messageType)渡されたタイプに使用するアイコンを返します。- パラメータ:
messageType- メッセージの一種- 戻り値:
- 渡された型に使用するアイコン
-
getMaxCharactersPerLineCount
protected int getMaxCharactersPerLineCount()1行に配置する最大文字数を返します。- 戻り値:
- 1行に配置する最大文字数
-
burstStringInto
dを表す新しいJLabelインスタンスを再帰的に作成します。 各JLabelインスタンスがcに追加されます。- パラメータ:
c- コンテナd- テキストmaxll- テキストの最大長
-
createSeparator
protected Container createSeparator()セパレータを返します。- 戻り値:
- セパレータ
-
createButtonArea
protected Container createButtonArea()ボタンを含むContainerを作成して返します。 ボタンは、getButtonsの呼出しにより作成されます。- 戻り値:
- ボタンを含む
Container
-
addButtonComponents
buttons内の各オブジェクトを表す適切なオブジェクトを作成し、それをcontainerに追加します。 addMessageComponentsとの違いは、buttonsを再帰的に扱うことと、ボタンがComponentでない場合にJButtonのインスタンスを作成することです。- パラメータ:
container- コンテナbuttons- ボタンの配列initialIndex- 初期インデックス
-
createButtonActionListener
protected ActionListener createButtonActionListener(int buttonIndex)ButtonActionListenerの新しいインスタンスを構築します。- パラメータ:
buttonIndex- ボタンのインデックス- 戻り値:
ButtonActionListenerの新しいインスタンス
-
getButtons
protected Object[] getButtons()レシーバがルック・アンド・フィールを提供しているJOptionPaneから表示するボタンを返します。JOptionPaneにオプションが設定されている場合はそれが提供され、そうでない場合はoptionTypeがYES_NO_OPTIONの場合はyesNoOptionsが返され、型がYES_NO_CANCEL_OPTIONの場合はyesNoCancelOptionsが返され、そうでない場合はdefaultButtonsが返されます。- 戻り値:
- JOptionPaneから表示するボタン
-
getSizeButtonsToSameWidth
protected boolean getSizeButtonsToSameWidth()戻り値true、基本L&Fは、すべてのボタンが同じ幅になるようにします。- 戻り値:
trueすべてのボタンの幅が同じである必要がある場合
-
getInitialValueIndex
protected int getInitialValueIndex()選択するボタンへの初期インデックスを返します。 このインデックスはJOptionPaneおよびJOptionPaneの各オプションからの初期値から計算されるか、または0です。- 戻り値:
- 選択するボタンの最初のインデックス
-
resetInputValue
protected void resetInputValue()レシーバがLook & Feelを提供しているオプション・ペイン内の入力値を、inputComponentの値を基にして設定します。 -
selectInitialValue
public void selectInitialValue(JOptionPane op)inputComponentがnullでない場合、フォーカスがそれで要求されます。そうでない場合は、フォーカスをデフォルト値で要求します。- 定義:
selectInitialValue、クラス:OptionPaneUI- パラメータ:
op-JOptionPane
-
containsCustomComponents
public boolean containsCustomComponents(JOptionPane op)validateComponentへの直前の呼出しでメッセージまたはボタンがComponentのサブクラスを含んでいた場合に、trueを返します。- 定義:
containsCustomComponents、クラス:OptionPaneUI- パラメータ:
op-JOptionPane- 戻り値:
- 指定された
JOptionPaneに、ユーザーが作成したComponentが含まれている場合はtrue
-