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 |
|
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() |
メッセージの本文を含むContainerを作成するために、installComponentsからメッセージが送られます。
|
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である場合、返される推奨サイズは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コントローラから、レシーバを削除します。
|
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, paint, updatepublic static final int MinimumWidth
public static final int MinimumHeight
protected JOptionPane optionPane
JOptionPaneです。protected Dimension minimumSize
protected JComponent inputComponent
protected Component initialFocusComponent
protected boolean hasCustomComponents
protected PropertyChangeListener propertyChangeListener
public static ComponentUI createUI(JComponent x)
public void installUI(JComponent c)
JOptionPaneのL&Fとしてレシーバをインストールします。installUI、クラスComponentUIc - UI委譲がインストールされるコンポーネントComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()public void uninstallUI(JComponent c)
uninstallUI、クラスComponentUIc - このUI委譲が削除されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがあるComponentUI.installUI(javax.swing.JComponent), JComponent.updateUI()protected void installDefaults()
protected void uninstallDefaults()
protected void installComponents()
protected void uninstallComponents()
protected LayoutManager createLayoutManager()
protected void installListeners()
protected void uninstallListeners()
protected PropertyChangeListener createPropertyChangeListener()
protected void installKeyboardActions()
protected void uninstallKeyboardActions()
public Dimension getMinimumOptionPaneSize()
public Dimension getPreferredSize(JComponent c)
cが、レシーバが含まれるJOptionPaneである場合、返される推奨サイズはJOptionPaneのLayoutManagerの推奨サイズの最大値とgetMinimumOptionPaneSizeです。getPreferredSize、クラスComponentUIc - 推奨サイズが照会されるコンポーネント。この引数は通常無視されるが、UIオブジェクトがステートレスで、複数のコンポーネントで共有されている場合は使用されることがあるJComponent.getPreferredSize(), LayoutManager.preferredLayoutSize(java.awt.Container)protected Container createMessageArea()
addIconを呼び出すことにより作成されます。 protected void addMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)
msgを表す適切なオブジェクトを作成し、それをcontainerに配置します。 msgがComponentのインスタンスである場合は、直接コンテナに追加されます。Iconである場合は、それを表すJLabelが作成されます。それ以外の場合は、文字列用のJLabelが作成されます。dがObject[]である場合、このメソッドは子のために再帰的に呼び出されます。ObjcがComponentのインスタンスで、このメソッドによって内部で作成された場合(これは、!internallyCreatedの場合にのみ、hasCustomComponentsを正しく設定するために使用されます)、internallyCreatedはtrueです。 protected Object getMessage()
protected void addIcon(Container top)
getIconから返されたアイコンを表すJLabelを作成して、topに追加します。 これは、createMessageAreaからメッセージとして送られます。 protected Icon getIcon()
getDefaultIconから返されたデフォルト・アイコンを返します。protected Icon getIconForType(int messageType)
protected int getMaxCharactersPerLineCount()
protected void burstStringInto(Container c, String d, int maxll)
dを表す新規JLabelインスタンスを再帰的に作成します。 JLabelの各インスタンスはcに追加されます。 protected Container createSeparator()
protected Container createButtonArea()
getButtonsの呼出しにより作成されます。 protected void addButtonComponents(Container container, Object[] buttons, int initialIndex)
buttons内の各オブジェクトを表す適切なオブジェクトを作成し、それをcontainerに追加します。 addMessageComponentsとの違いは、buttonsを再帰的に扱うことと、ボタンがComponentでない場合にJButtonのインスタンスを作成することです。 protected ActionListener createButtonActionListener(int buttonIndex)
protected Object[] getButtons()
protected boolean getSizeButtonsToSameWidth()
protected int getInitialValueIndex()
protected void resetInputValue()
public void selectInitialValue(JOptionPane op)
selectInitialValue、クラスOptionPaneUIpublic boolean containsCustomComponents(JOptionPane op)
バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。