クラス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 final int
    JOptionPaneの最小の高さ。
    protected Dimension
    JOptionPaneのサイズ。
    static final int
    JOptionPaneの最小幅。
    protected JOptionPane
    レシーバがLook & Feelを提供しているJOptionPaneです。
    PropertyChangeListenerのインスタンス。
  • コンストラクタのサマリー

    コンストラクタ
    コンストラクタ
    説明
    BasicOptionPaneUIを構築します。
  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    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
    installComponentsからメッセージを送信して、メッセージの本文を含むContainerを作成します。
    PropertyChangeListenerのインスタンスを返します。
    protected Container
    セパレータを返します。
    新しいBasicOptionPaneUIインスタンスを作成します。
    protected Object[]
    レシーバがルック・アンド・フィールを提供しているJOptionPaneから表示するボタンを返します。
    protected Icon
    レシーバがルック・アンド・フィールを提供しているJOptionPaneのアイコン、またはgetDefaultIconから返されたデフォルトのアイコンを返します。
    protected Icon
    getIconForType(int messageType)
    渡されたタイプに使用するアイコンを返します。
    protected int
    選択するボタンへの初期インデックスを返します。
    protected int
    1行に配置する最大文字数を返します。
    protected Object
    レシーバがルック・アンド・フィールを提供しているJOptionPaneから表示するメッセージを返します。
    オプション・ペインの最小サイズを返します。
    cが、レシーバが含まれるJOptionPaneである場合、返される推奨サイズはJOptionPaneLayoutManagerの推奨サイズの最大値とgetMinimumOptionPaneSizeです。
    protected boolean
    trueを返します。基本的なL&Fでは、すべてのボタンの幅が同じになります。
    protected void
    コンポーネントを登録します。
    protected void
    デフォルトのプロパティをインストールします。
    protected void
    キーボード操作を登録します。
    protected void
    リスナーを登録します。
    void
    渡されたJOptionPaneのL&Fとしてレシーバをインストールします。
    protected void
    レシーバがLook & Feelを提供しているオプション・ペイン内の入力値を、inputComponentの値を基にして設定します。
    void
    inputComponentがnullでない場合、フォーカスがそれで要求されます。そうでない場合は、フォーカスをデフォルト値で要求します。
    protected void
    コンポーネントの登録を解除します。
    protected void
    既定のプロパティをアンインストールします。
    protected void
    キーボード操作の登録を解除します。
    protected void
    リスナーを登録解除します。
    void
    渡された分割ペインのL&Fコントローラから、レシーバを削除します。

    クラスで宣言されたメソッド ComponentUI

    contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, paint, update
    修飾子と型
    メソッド
    説明
    boolean
    contains(JComponent c, int x, int y)
    指定された x,yの位置が、指定されたコンポーネントのLook & Feel定義の形状内にある場合は、trueを返します。
    オブジェクトのi番目のAccessibleの子を返します。
    int
    オブジェクト内のアクセシビリティ対応の子の数を返します。
    int
    getBaseline(JComponent c, int width, int height)
    ベースラインを返します。
    サイズの変化に合わせてコンポーネントのベースラインがどのように変化するかを示す列挙を返します。
    指定されたコンポーネントの、Look & Feelに適した最大サイズを返します。
    指定されたコンポーネントの、Look & Feelに適した最小サイズを返します。
    void
    指定されたコンポーネントをLook & Feelに合わせてペイントします。
    void
    指定されたコンポーネントをペイントする時間になったことを、このUI委譲に通知します。

    クラスオブジェクトで宣言されたメソッド

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    修飾子と型
    メソッド
    説明
    protected Object
    このオブジェクトのコピーを作成して、返します。
    boolean
    このオブジェクトと他のオブジェクトが等しいかどうかを示します。
    protected void
    削除予定のため非推奨: このAPI要素は、将来のバージョンで削除される可能性があります。
    最終決定は非推奨であり、将来のリリースで削除される可能性があります。
    final Class<?>
    このObjectの実行時クラスを返します。
    int
    このオブジェクトに対するハッシュ・コード値を返します。
    final void
    このオブジェクトのモニターで待機中のスレッドを1つ再開します。
    final void
    このオブジェクトのモニターで待機中のすべてのスレッドを再開します。
    オブジェクトの文字列表現を返します。
    final void
    現在のスレッドが目覚めるまで待機します。通常、notifiedまたはinterruptedです。
    final void
    wait(long timeoutMillis)
    現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
    final void
    wait(long timeoutMillis, int nanos)
    現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
  • フィールド詳細

    • 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のインスタンス。
  • コンストラクタの詳細

    • 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委譲がインストールされるコンポーネント
      関連項目:
    • uninstallUI

      public void uninstallUI(JComponent c)
      渡された分割ペインのL&Fコントローラから、レシーバを削除します。
      オーバーライド:
      uninstallUI、クラスComponentUI
      パラメータ:
      c - このUI委譲が削除されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがある
      関連項目:
    • 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である場合、返される推奨サイズはJOptionPaneLayoutManagerの推奨サイズの最大値とgetMinimumOptionPaneSizeです。
      オーバーライド:
      getPreferredSize、クラスComponentUI
      パラメータ:
      c - 適切なサイズが照会されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがある
      戻り値:
      ルック・アンド・フィールに適した特定のコンポーネントの優先サイズを含むDimensionオブジェクト
      関連項目:
    • createMessageArea

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

      protected void addMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)
      msgを表す適切なオブジェクトを作成し、それをcontainerに配置します。 msgComponentのインスタンスである場合は、直接追加されます。Iconの場合は、JLabelが作成され、それ以外の場合は文字列にJLabelが作成されます。 msgがObject []の場合、このメソッドは子に対して再帰的に呼び出されます。msgComponentのインスタンスであり、このメソッド(これは、internallyCreatedfalseの場合にのみhasCustomComponentsを正しく設定するために使用されます)によって内部的に作成された場合、internallyCreatedtrueです。
      パラメータ:
      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 - a JOptionPane
    • containsCustomComponents

      public boolean containsCustomComponents(JOptionPane op)
      validateComponentへの直前の呼出しでメッセージまたはボタンがComponentのサブクラスを含んでいた場合に、trueを返します。
      定義:
      containsCustomComponents、クラスOptionPaneUI
      パラメータ:
      op - a JOptionPane
      戻り値:
      指定されたJOptionPaneに、ユーザーが作成したComponentが含まれている場合はtrue