- 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メソッドで決定されます。
-
-
ネストされたクラスのサマリー
ネストされたクラス 修飾子と型 クラス 説明 class
BasicOptionPaneUI.ButtonActionListener
このクラスは、「protected」内部クラスとして扱うようにしてください。static class
BasicOptionPaneUI.ButtonAreaLayout
ButtonAreaLayout
は、FlowLayout
と同様に動作します。class
BasicOptionPaneUI.PropertyChangeHandler
このクラスは、「protected」内部クラスとして扱うようにしてください。
-
フィールドのサマリー
フィールド 修飾子と型 フィールド 説明 protected boolean
hasCustomComponents
Componentがメッセージまたはボタンに含まれる場合に、validateComponentでtrueに設定されます。protected Component
initialFocusComponent
selectInitialValueでメッセージが送られたときに、フォーカスを受け取るコンポーネントです。protected JComponent
inputComponent
optionPane.getWantsInput()がtrueを返す場合に、JComponentが入力を用意します。static int
MinimumHeight
JOptionPane
の最小値。protected Dimension
minimumSize
JOptionPane
のサイズ。static int
MinimumWidth
JOptionPane
の最小幅。protected JOptionPane
optionPane
レシーバがLook & Feelを提供しているJOptionPane
です。protected PropertyChangeListener
propertyChangeListener
PropertyChangeListener
のインスタンス。
-
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 BasicOptionPaneUI()
-
メソッドのサマリー
すべてのメソッド 静的メソッド インスタンス・メソッド 具象メソッド 修飾子と型 メソッド 説明 protected void
addButtonComponents(Container container, Object[] buttons, int initialIndex)
buttons
内の各オブジェクトを表す適切なオブジェクトを作成し、それをcontainer
に追加します。protected void
addIcon(Container top)
getIcon
から返されたアイコンを表すJLabelを作成して、top
に追加します。protected void
addMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)
msg
を表す適切なオブジェクトを作成し、それをcontainer
に配置します。protected void
burstStringInto(Container c, String d, int maxll)
d
を表す新しいJLabel
インスタンスを再帰的に作成します。boolean
containsCustomComponents(JOptionPane op)
validateComponentへの直前の呼出しでメッセージまたはボタンがComponentのサブクラスを含んでいた場合に、trueを返します。protected ActionListener
createButtonActionListener(int buttonIndex)
ButtonActionListener
の新しいインスタンスを構築します。protected Container
createButtonArea()
ボタンを含むContainer
を作成して返します。protected LayoutManager
createLayoutManager()
レイアウト・マネージャを返します。protected Container
createMessageArea()
メッセージの本文を含むContainer
を作成するためにinstallComponents
からメッセージされます。protected PropertyChangeListener
createPropertyChangeListener()
PropertyChangeListener
のインスタンスを返します。protected Container
createSeparator()
セパレータを返します。static ComponentUI
createUI(JComponent x)
新しいBasicOptionPaneUI
インスタンスを作成します。protected Object[]
getButtons()
レシーバがルック・アンド・フィールを提供しているJOptionPane
から表示するボタンを返します。protected Icon
getIcon()
レシーバがルック・アンド・フィールを提供しているJOptionPane
からのアイコン、またはgetDefaultIcon
から返されたデフォルトのアイコンを返します。protected Icon
getIconForType(int messageType)
渡されたタイプに使用するアイコンを返します。protected int
getInitialValueIndex()
選択するボタンへの初期インデックスを返します。protected int
getMaxCharactersPerLineCount()
1行に配置する最大文字数を返します。protected Object
getMessage()
レシーバがルック・アンド・フィールを提供しているJOptionPane
から表示するメッセージを返します。Dimension
getMinimumOptionPaneSize()
オプション・ペインの最小サイズを返します。Dimension
getPreferredSize(JComponent c)
c
が、レシーバが含まれるJOptionPane
である場合、返される推奨サイズはJOptionPane
のLayoutManager
の推奨サイズの最大値とgetMinimumOptionPaneSize
です。protected boolean
getSizeButtonsToSameWidth()
戻り値true
、基本L&Fは、すべてのボタンが同じ幅になるようにします。protected void
installComponents()
コンポーネントを登録します。protected void
installDefaults()
デフォルトのプロパティをインストールします。protected void
installKeyboardActions()
キーボード操作を登録します。protected void
installListeners()
リスナーを登録します。void
installUI(JComponent c)
渡されたJOptionPane
のL&Fとしてレシーバをインストールします。protected void
resetInputValue()
レシーバがLook & Feelを提供しているオプション・ペイン内の入力値を、inputComponentの値を基にして設定します。void
selectInitialValue(JOptionPane op)
inputComponentがnullでない場合、フォーカスがそれで要求されます。そうでない場合は、フォーカスをデフォルト値で要求します。protected void
uninstallComponents()
コンポーネントの登録を解除します。protected void
uninstallDefaults()
既定のプロパティをアンインストールします。protected void
uninstallKeyboardActions()
キーボード操作の登録を解除します。protected void
uninstallListeners()
リスナーを登録解除します。void
uninstallUI(JComponent c)
渡された分割ペインのL&Fコントローラから、レシーバを削除します。-
クラス javax.swing.plaf.ComponentUIで宣言されたメソッド
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, paint, update
-
-
-
-
フィールドの詳細
-
MinimumWidth
public static final int MinimumWidth
JOptionPane
の最小幅。- 関連項目:
- 定数フィールド値
-
MinimumHeight
public static final int MinimumHeight
JOptionPane
の最小値。- 関連項目:
- 定数フィールド値
-
optionPane
protected JOptionPane optionPane
レシーバがLook & Feelを提供しているJOptionPane
です。
-
minimumSize
protected Dimension minimumSize
JOptionPane
のサイズ。
-
inputComponent
protected JComponent inputComponent
optionPane.getWantsInput()がtrueを返す場合に、JComponentが入力を用意します。
-
initialFocusComponent
protected Component initialFocusComponent
selectInitialValueでメッセージが送られたときに、フォーカスを受け取るコンポーネントです。
-
hasCustomComponents
protected boolean hasCustomComponents
Componentがメッセージまたはボタンに含まれる場合に、validateComponentでtrueに設定されます。
-
propertyChangeListener
protected PropertyChangeListener propertyChangeListener
PropertyChangeListener
のインスタンス。
-
-
メソッドの詳細
-
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
protected void burstStringInto(Container c, String d, int maxll)
d
を表す新しいJLabel
インスタンスを再帰的に作成します。 各JLabel
インスタンスがc
に追加されます。- パラメータ:
c
- コンテナd
- テキストmaxll
- テキストの最大長
-
createSeparator
protected Container createSeparator()
セパレータを返します。- 戻り値:
- セパレータ
-
createButtonArea
protected Container createButtonArea()
ボタンを含むContainer
を作成して返します。 ボタンは、getButtons
の呼出しにより作成されます。- 戻り値:
- ボタンを含む
Container
-
addButtonComponents
protected void addButtonComponents(Container container, Object[] buttons, int initialIndex)
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
-
-