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
このクラスは、「protected」内部クラスとして扱うようにしてください。static class
ButtonAreaLayout
は、FlowLayout
と同様に動作します。class
このクラスは、「protected」内部クラスとして扱うようにしてください。 -
フィールドのサマリー
フィールド修飾子と型フィールド説明protected boolean
Componentがメッセージまたはボタンに含まれる場合に、validateComponentでtrueに設定されます。protected Component
selectInitialValueでメッセージが送られたときに、フォーカスを受け取るコンポーネントです。protected JComponent
optionPane.getWantsInput()がtrueを返す場合に、JComponentが入力を用意します。static int
JOptionPane
の最小値。protected Dimension
JOptionPane
のサイズ。static int
JOptionPane
の最小幅。protected JOptionPane
レシーバがLook & Feelを提供しているJOptionPane
です。protected PropertyChangeListener
PropertyChangeListener
のインスタンス。 -
コンストラクタのサマリー
コンストラクタ -
メソッドのサマリー
修飾子と型メソッド説明protected void
addButtonComponents(Container container, Object[] buttons, int initialIndex)
buttons
内の各オブジェクトを表す適切なオブジェクトを作成し、それをcontainer
に追加します。protected void
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
validateComponentへの直前の呼出しでメッセージまたはボタンがComponentのサブクラスを含んでいた場合に、trueを返します。protected ActionListener
createButtonActionListener(int buttonIndex)
ButtonActionListener
の新しいインスタンスを構築します。protected Container
ボタンを含むContainer
を作成して返します。protected LayoutManager
レイアウト・マネージャを返します。protected Container
メッセージの本文を含むContainer
を作成するためにinstallComponents
からメッセージされます。protected PropertyChangeListener
PropertyChangeListener
のインスタンスを返します。protected Container
セパレータを返します。static ComponentUI
createUI(JComponent x)
新しいBasicOptionPaneUI
インスタンスを作成します。protected Object[]
レシーバがルック・アンド・フィールを提供しているJOptionPane
から表示するボタンを返します。protected Icon
getIcon()
レシーバがルック・アンド・フィールを提供しているJOptionPane
からのアイコン、またはgetDefaultIcon
から返されたデフォルトのアイコンを返します。protected Icon
getIconForType(int messageType)
渡されたタイプに使用するアイコンを返します。protected int
選択するボタンへの初期インデックスを返します。protected int
1行に配置する最大文字数を返します。protected Object
レシーバがルック・アンド・フィールを提供しているJOptionPane
から表示するメッセージを返します。オプション・ペインの最小サイズを返します。c
が、レシーバが含まれるJOptionPane
である場合、返される推奨サイズはJOptionPane
のLayoutManager
の推奨サイズの最大値とgetMinimumOptionPaneSize
です。protected boolean
戻り値true
、基本L&Fは、すべてのボタンが同じ幅になるようにします。protected void
コンポーネントを登録します。protected void
デフォルトのプロパティをインストールします。protected void
キーボード・アクションを登録します。protected void
リスナーを登録します。void
installUI(JComponent c)
渡されたJOptionPane
のL&Fとしてレシーバをインストールします。protected void
レシーバがLook & Feelを提供しているオプション・ペイン内の入力値を、inputComponentの値を基にして設定します。void
inputComponentがnullでない場合、フォーカスがそれで要求されます。そうでない場合は、フォーカスをデフォルト値で要求します。protected void
コンポーネントの登録を解除します。protected void
デフォルト・プロパティをアンインストールします。protected void
キーボード・アクションを登録解除します。protected void
リスナーの登録を解除します。void
渡された分割ペインの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()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
-