所有类


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 提供基本外观。BasicMessagePaneUI 提供将图标、消息和按钮置于 Container 中的方法。一般情况下,布局如下所示:

        ------------------
        | i | message    |
        | c | message    |
        | o | message    |
        | n | message    |
        ------------------
        |     buttons    |
        |________________|
 
图标是 Icon 的实例,包装在 JLabel 中。消息是不透明对象,用于测试:如果消息为 Component,则将其添加到 Container;如果其为 Icon,则将其包装在 JLabel 中并添加到 Container,否则将其包装在 JLabel 中。

当选项窗格的 ComponentOrientation 属性为水平的从左到右时,使用上述布局。布局将针对其他方向进行适当调整。

Container、消息、图标和按钮都是根据抽象方法确定的。


嵌套类摘要
 classBasicOptionPaneUI.ButtonActionListener
          此内部类因编译器故障而被标记为“公开”。
static classBasicOptionPaneUI.ButtonAreaLayout
          ButtonAreaLayout 的行为方式类似于 FlowLayout
 classBasicOptionPaneUI.PropertyChangeHandler
          此内部类因编译器故障而被标记为“公开”。
 
字段摘要
protected  booleanhasCustomComponents
          如果 Component 包含在消息或按钮中,则将其设置为 true。
protected  ComponentinitialFocusComponent
          利用 selectInitialValue 传递消息时接收焦点的组件。
protected  JComponentinputComponent
          如果 optionPane.getWantsInput() 返回 true,则 JComponent 提供输入。
static intMinimumHeight
           
protected  DimensionminimumSize
           
static intMinimumWidth
           
protected  JOptionPaneoptionPane
          接收者为其提供外观的 JOptionPane
protected  PropertyChangeListenerpropertyChangeListener
           
 
构造方法摘要
BasicOptionPaneUI()
           
 
方法摘要
protected  voidaddButtonComponents(Container container, Object[] buttons, int initialIndex)
          创建表示 buttons 中每个对象的适当对象并将其添加到 container
protected  voidaddIcon(Container top)
          创建并添加 JLabel,它表示对 top 调用 getIcon 所返回的图标。
protected  voidaddMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)
          创建表示 msg 的适当对象并将其置于 container 中。
protected  voidburstStringInto(Container c, String d, int maxll)
          递归式创建表示 d 的新 JLabel 实例每个 JLabel 实例都将被添加到 c
 booleancontainsCustomComponents(JOptionPane op)
          如果在上一次对 validateComponent 的调用中消息或按钮包含 Component 的子类,则返回 true。
protected  ActionListenercreateButtonActionListener(int buttonIndex)
           
protected  ContainercreateButtonArea()
          创建并返回包含按钮的 Container。
protected  LayoutManagercreateLayoutManager()
           
protected  ContainercreateMessageArea()
          从 installComponents 获取消息以创建包含消息正文的 Container。
protected  PropertyChangeListenercreatePropertyChangeListener()
           
protected  ContainercreateSeparator()
           
static ComponentUIcreateUI(JComponent x)
          创建一个新的 BasicOptionPaneUI 实例。
protected  Object[]getButtons()
          返回从接收者为其提供外观的 JOptionPane 显示的按钮。
protected  IcongetIcon()
          返回来自接收者为其提供外观的 JOptionPane 的图标,或者从 getDefaultIcon 返回的默认图标。
protected  IcongetIconForType(int messageType)
          返回用于传入类型的图标。
protected  intgetInitialValueIndex()
          将初始索引返回给要选择的按钮。
protected  intgetMaxCharactersPerLineCount()
          返回要置于行中的最大字符数。
protected  ObjectgetMessage()
          返回从接收者为其提供外观的 JOptionPane 显示的消息。
 DimensiongetMinimumOptionPaneSize()
          返回选项窗格应该具有的最小大小。
 DimensiongetPreferredSize(JComponent c)
          如果 c 为包含接收者的 JOptionPane,则返回的首选大小为 JOptionPaneLayoutManager 的最大首选大小和 getMinimumOptionPaneSize
protected  booleangetSizeButtonsToSameWidth()
          返回 true,基本 L&F 希望所有按钮具有相同的宽度。
protected  voidinstallComponents()
           
protected  voidinstallDefaults()
           
protected  voidinstallKeyboardActions()
           
protected  voidinstallListeners()
           
 voidinstallUI(JComponent c)
          安装作为传入 JOptionPane 的 L&F 的接收者。
protected  voidresetInputValue()
          基于 inputComponent 中的值,设置接收者为其提供外观的选项窗格中的输入值。
 voidselectInitialValue(JOptionPane op)
          如果 inputComponent 为非 null,则请求焦点位于其上;否则请求焦点位于默认值上
protected  voiduninstallComponents()
           
protected  voiduninstallDefaults()
           
protected  voiduninstallKeyboardActions()
           
protected  voiduninstallListeners()
           
 voiduninstallUI(JComponent c)
          从传入拆分窗格的 L&F 控制器移除接收者。
 
从类 javax.swing.plaf.ComponentUI 继承的方法
contains, getAccessibleChild, getAccessibleChildrenCount, 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
接收者为其提供外观的 JOptionPane


minimumSize

protected Dimension minimumSize

inputComponent

protected JComponent inputComponent
如果 optionPane.getWantsInput() 返回 true,则 JComponent 提供输入。


initialFocusComponent

protected Component initialFocusComponent
利用 selectInitialValue 传递消息时接收焦点的组件。


hasCustomComponents

protected boolean hasCustomComponents
如果 Component 包含在消息或按钮中,则将其设置为 true。