JavaTM Platform
Standard Ed. 6

javax.swing.plaf.basic
クラス BasicOptionPaneUI

java.lang.Object
  上位を拡張 javax.swing.plaf.ComponentUI
      上位を拡張 javax.swing.plaf.OptionPaneUI
          上位を拡張 javax.swing.plaf.basic.BasicOptionPaneUI

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、メッセージ、アイコン、およびボタンは、すべて抽象メソッドで決定されます。


入れ子のクラスの概要
 class BasicOptionPaneUI.ButtonActionListener
          この内部クラスは「public」とマークされますが、これはコンパイラのバグが原因です。
static class BasicOptionPaneUI.ButtonAreaLayout
          ButtonAreaLayout は、FlowLayout と同様の動作をします。
 class BasicOptionPaneUI.PropertyChangeHandler
          この内部クラスは「public」とマークされますが、これはコンパイラのバグが原因です。
 
フィールドの概要
protected  boolean hasCustomComponents
          Component がメッセージまたはボタンに含まれる場合に、このフィールドは validateComponent で true に設定されます。
protected  Component initialFocusComponent
          selectInitialValue を使ってメッセージが送られたときに、フォーカスを受け取るコンポーネントです。
protected  JComponent inputComponent
          optionPane.getWantsInput() が true を返した場合に、JComponent が入力を提供します。
static int MinimumHeight
           
protected  Dimension minimumSize
           
static int MinimumWidth
           
protected  JOptionPane optionPane
          レシーバが Look & Feel を提供する JOptionPane です。
protected  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)
           
protected  Container createButtonArea()
          ボタンを含む Container を作成して返します。
protected  LayoutManager createLayoutManager()
           
protected  Container createMessageArea()
          installComponents からメッセージとして送られて、メッセージの本文を含む Container を作成します。
protected  PropertyChangeListener createPropertyChangeListener()
           
protected  Container createSeparator()
           
static ComponentUI createUI(JComponent x)
          BasicOptionPaneUI の新規インスタンスを生成します。
protected  Object[] getButtons()
          レシーバが Look & Feel を提供している JOptionPane から、表示するボタンを返します。
protected  Icon getIcon()
          レシーバが Look & Feel を提供している JOptionPane からアイコンを返すか、getDefaultIcon で返されたデフォルトアイコンを返します。
protected  Icon getIconForType(int messageType)
          渡された型用のアイコンを返します。
protected  int getInitialValueIndex()
          選択するボタンに最初のインデックスを返します。
protected  int getMaxCharactersPerLineCount()
          1 行の最大文字数を返します。
protected  Object getMessage()
          レシーバが Look & Feel を提供している JOptionPane から、表示するメッセージを返します。
 Dimension getMinimumOptionPaneSize()
          オプションの区画の最小サイズを返します。
 Dimension getPreferredSize(JComponent c)
          c がレシーバを含んだ JOptionPane である場合、返される適切なサイズは、JOptionPaneLayoutManager および getMinimumOptionPaneSize の適切なサイズの最大値です。
protected  boolean getSizeButtonsToSameWidth()
          true を返します。
protected  void installComponents()
           
protected  void installDefaults()
           
protected  void installKeyboardActions()
           
protected  void installListeners()
           
 void installUI(JComponent c)
          渡された JOptionPane のための Look & Feel としてレシーバをインストールします。
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)
          渡された分割区画の Look & Feel コントローラから、レシーバを削除します。
 
クラス javax.swing.plaf.ComponentUI から継承されたメソッド
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, paint, update
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

MinimumWidth

public static final int MinimumWidth
関連項目:
定数フィールド値

MinimumHeight

public static final int MinimumHeight
関連項目:
定数フィールド値

optionPane

protected JOptionPane optionPane
レシーバが Look & Feel を提供する JOptionPane です。


minimumSize

protected Dimension minimumSize

inputComponent

protected JComponent inputComponent
optionPane.getWantsInput() が true を返した場合に、JComponent が入力を提供します。


initialFocusComponent

protected Component initialFocusComponent
selectInitialValue を使ってメッセージが送られたときに、フォーカスを受け取るコンポーネントです。


hasCustomComponents

protected boolean hasCustomComponents
Component がメッセージまたはボタンに含まれる場合に、このフィールドは validateComponent で true に設定されます。


propertyChangeListener

protected PropertyChangeListener propertyChangeListener
コンストラクタの詳細

BasicOptionPaneUI

public BasicOptionPaneUI()
メソッドの詳細

createUI

public static ComponentUI createUI(JComponent x)
BasicOptionPaneUI の新規インスタンスを生成します。


installUI

public void installUI(JComponent c)
渡された JOptionPane のための Look & Feel としてレシーバをインストールします。

オーバーライド:
クラス ComponentUI 内の installUI
パラメータ:
c - UI 委譲がインストールされているコンポーネント
関連項目:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

uninstallUI

public void uninstallUI(JComponent c)
渡された分割区画の Look & Feel コントローラから、レシーバを削除します。

オーバーライド:
クラス ComponentUI 内の uninstallUI
パラメータ:
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()

installKeyboardActions

protected void installKeyboardActions()

uninstallKeyboardActions

protected void uninstallKeyboardActions()

getMinimumOptionPaneSize

public Dimension getMinimumOptionPaneSize()
オプションの区画の最小サイズを返します。主に、異なる最小サイズを提供しようとするサブクラスのために提供されています。


getPreferredSize

public Dimension getPreferredSize(JComponent c)
c がレシーバを含んだ JOptionPane である場合、返される適切なサイズは、JOptionPaneLayoutManager および getMinimumOptionPaneSize の適切なサイズの最大値です。

オーバーライド:
クラス ComponentUI 内の getPreferredSize
パラメータ:
c - 適切なサイズを照会されるコンポーネント。 この引数は通常無視されるが、 UI オブジェクトに状態がなく、複数のコンポーネントに共有されている場合は 使用されることがある
関連項目:
JComponent.getPreferredSize(), LayoutManager.preferredLayoutSize(java.awt.Container)

createMessageArea

protected Container createMessageArea()
installComponents からメッセージとして送られて、メッセージの本文を含む Container を作成します。アイコンは、addIcon を呼び出すことにより作成されます。


addMessageComponents

protected void addMessageComponents(Container container,
                                    GridBagConstraints cons,
                                    Object msg,
                                    int maxll,
                                    boolean internallyCreated)
msg を表す適切なオブジェクトを作成し、それを container に配置します。msg が Component のインスタンスである場合は、直接コンテナに追加されます。msg が Icon である場合は、それを表す JLabel が作成されます。 そうでない場合は、JLabel が文字列のために作成されます。 d が Object[] である場合、このメソッドは子のために再帰的に呼び出されます。 Objc が Component のインスタンスであり、このメソッドによって内部で作成されたものである場合、internallyCreated は true です。 これは、!internallyCreated である場合にだけ、hasCustomComponents を正しく設定するために使用されます。


getMessage

protected Object getMessage()
レシーバが Look & Feel を提供している JOptionPane から、表示するメッセージを返します。


addIcon

protected void addIcon(Container top)
getIcon から返されたアイコンを表す JLabel を作成して、top に追加します。これは、createMessageArea からメッセージとして送られます。


getIcon

protected Icon getIcon()
レシーバが Look & Feel を提供している JOptionPane からアイコンを返すか、getDefaultIcon で返されたデフォルトアイコンを返します。


getIconForType

protected Icon getIconForType(int messageType)
渡された型用のアイコンを返します。


getMaxCharactersPerLineCount

protected int getMaxCharactersPerLineCount()
1 行の最大文字数を返します。


burstStringInto

protected void burstStringInto(Container c,
                               String d,
                               int maxll)
d を表す JLabel の新規インスタンスを再帰的に生成します。JLabel の各インスタンスは c に追加されます。


createSeparator

protected Container createSeparator()

createButtonArea

protected Container createButtonArea()
ボタンを含む Container を作成して返します。ボタンは、getButtons の呼び出しにより作成されます。


addButtonComponents

protected void addButtonComponents(Container container,
                                   Object[] buttons,
                                   int initialIndex)
buttons にある各オブジェクトを表す適切なオブジェクトを作成し、それを container に追加します。このメソッドの addMessageComponents との違いは、buttons を再帰的に扱うことと、ボタンが Component でない場合に、JButton のインスタンスを生成することです。


createButtonActionListener

protected ActionListener createButtonActionListener(int buttonIndex)

getButtons

protected Object[] getButtons()
レシーバが Look & Feel を提供している JOptionPane から、表示するボタンを返します。JOptionPane にオプションが設定されている場合は、それらが提供されます。 そうでない場合は、オプション型が YES_NO_OPTION であれば、yesNoOptions が返されます。 オプション型が YES_NO_CANCEL_OPTION であれば、yesNoCancelOptions が返されます。 そうでない場合は、defaultButtons が返されます。


getSizeButtonsToSameWidth

protected boolean getSizeButtonsToSameWidth()
true を返します。基本 Look & Feel では、すべてのボタンを同じ幅にすることが必要です。


getInitialValueIndex

protected int getInitialValueIndex()
選択するボタンに最初のインデックスを返します。このインデックスは JOptionPane および JOptionPane の各オプションの初期値から計算されるか、あるいは 0 になります。


resetInputValue

protected void resetInputValue()
レシーバが Look & Feel を提供しているオプション区画での入力値を、inputComponent の値を基にして設定します。


selectInitialValue

public void selectInitialValue(JOptionPane op)
inputComponent が null でない場合、フォーカスはその入力コンポーネントに要求されます。そうでない場合は、デフォルトの値に従ってフォーカスが要求されます。

定義:
クラス OptionPaneUI 内の selectInitialValue

containsCustomComponents

public boolean containsCustomComponents(JOptionPane op)
validateComponent への直前の呼び出しでメッセージまたはボタンが Component のサブクラスを含む場合に、true を返します。

定義:
クラス OptionPaneUI 内の containsCustomComponents

JavaTM Platform
Standard Ed. 6

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。