public class BasicOptionPaneUI extends OptionPaneUI
JOptionPane
。
BasicMessagePaneUI
提供了一种手段来放置一个图标,消息和按钮进入
Container
。一般来说,布局的样子:
------------------|我|消息|| C |消息|| O |消息|| N |消息|------------------|按钮|| ________________ |图标是
Icon
,里面裹着一个
JLabel
实例。消息是一个不透明的对象和测试如下:如果消息是
Component
它添加到
Container
,如果它是一个
Icon
是包裹在一
JLabel
和添加到
Container
否则,它是包裹在一
JLabel
。
上述布局时使用的选项窗格中的ComponentOrientation
财产是横向的,从左到右。该布局将适当调整其他方向。
的Container
,消息,图标和按钮都是从抽象的方法确定。
Modifier and Type | Class and Description |
---|---|
class |
BasicOptionPaneUI.ButtonActionListener
这个类应该被视为一个“受保护的”内部类。
|
static class |
BasicOptionPaneUI.ButtonAreaLayout
ButtonAreaLayout 表现以类似的方式来
FlowLayout 。
|
class |
BasicOptionPaneUI.PropertyChangeHandler
这个类应该被视为一个“受保护的”内部类。
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
hasCustomComponents
这是设置为true,在validatecomponent如果组件包含在消息或按钮。
|
protected Component |
initialFocusComponent
组件接收焦点时,与selectinitialvalue。
|
protected JComponent |
inputComponent
如果optionpane JComponent提供输入。getwantsinput()返回true。
|
static int |
MinimumHeight |
protected Dimension |
minimumSize |
static int |
MinimumWidth |
protected JOptionPane |
optionPane
JOptionPane ,接收机提供的外观和感觉。
|
protected PropertyChangeListener |
propertyChangeListener |
Constructor and Description |
---|
BasicOptionPaneUI() |
Modifier and Type | Method and Description |
---|---|
protected void |
addButtonComponents(Container container, Object[] buttons, int initialIndex)
创建代表每个对象在
buttons 合适的对象并将其添加到
container 。
|
protected void |
addIcon(Container top)
创建和添加JLabel代表图标返回到
top
getIcon 。
|
protected void |
addMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)
创建代表
msg 放进
container 合适的对象。
|
protected void |
burstStringInto(Container c, String d, int maxll)
递归创建新JLabel实例表示
d 。
|
boolean |
containsCustomComponents(JOptionPane op)
如果在最后调用validatecomponent消息或按钮包含组件的子类返回true。
|
protected ActionListener |
createButtonActionListener(int buttonIndex) |
protected Container |
createButtonArea()
创建并返回包含按钮的容器。
|
protected LayoutManager |
createLayoutManager() |
protected Container |
createMessageArea()
消息从installcomponents创建包含消息体中的容器。
|
protected PropertyChangeListener |
createPropertyChangeListener() |
protected Container |
createSeparator() |
static ComponentUI |
createUI(JComponent x)
创建一个新的basicoptionpaneui实例。
|
protected Object[] |
getButtons()
返回按钮来显示从JOptionPane接收机提供的外观和感觉。
|
protected Icon |
getIcon()
返回从JOptionPane接收机提供的外观和感觉的图标,或默认的图标
getDefaultIcon 归来。
|
protected Icon |
getIconForType(int messageType)
返回用于类型传递的图标。
|
protected int |
getInitialValueIndex()
返回到按钮选择的初始索引。
|
protected int |
getMaxCharactersPerLineCount()
返回在行上放置的最大字符数。
|
protected Object |
getMessage()
返回消息显示从JOptionPane接收机提供的外观和感觉。
|
Dimension |
getMinimumOptionPaneSize()
返回选项窗格中的最小大小。
|
Dimension |
getPreferredSize(JComponent c)
如果
c 是
JOptionPane 接收机中,首选大小,还为
JOptionPane 对
LayoutManager 首选大小的最大值,并
getMinimumOptionPaneSize 。
|
protected boolean |
getSizeButtonsToSameWidth()
返回真,基本的L和F希望所有的按钮有相同的宽度。
|
protected void |
installComponents() |
protected void |
installDefaults() |
protected void |
installKeyboardActions() |
protected void |
installListeners() |
void |
installUI(JComponent c)
安装接收器为通过
JOptionPane L & F。
|
protected void |
resetInputValue()
设置输入值的选项窗格接收机提供的外观和感觉的基础上在inputcomponent价值。
|
void |
selectInitialValue(JOptionPane op)
如果inputcomponent是非空的,重点是要求上,否则请求默认值的焦点
|
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, update
public 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
方法重写,继承类
ComponentUI
c
-组件,UI代理被安装
ComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public void uninstallUI(JComponent c)
uninstallUI
方法重写,继承类
ComponentUI
c
-从这个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
方法重写,继承类
ComponentUI
c
优先度的被查询的成分;这种说法常常被忽视,但可能如果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
是组件的一个实例,它是直接加入,如果它是一个图标,一个JLabel来表示它,否则一个JLabel是字符串创建的,如果
d
[ ]是一个对象,该方法将递归调用孩子们。如果objc是组件的一个实例,并用该方法内部创建的
internallyCreated
是真实的(这是用来设置正确hascustomcomponents只有!internallycreated)。
protected Object getMessage()
protected void addIcon(Container top)
top
getIcon
。这是从
createMessageArea
消息
protected Icon getIcon()
getDefaultIcon
归来。
protected Icon getIconForType(int messageType)
protected int getMaxCharactersPerLineCount()
protected void burstStringInto(Container c, String d, int maxll)
d
。每个JLabel实例加入
c
。
protected Container createSeparator()
protected Container createButtonArea()
getButtons
创建按钮。
protected void addButtonComponents(Container container, Object[] buttons, int initialIndex)
buttons
合适的对象并将其添加到
container
。这不同于addmessagecomponents在会上,如果递归
buttons
按钮不是组件将创建JButton的实例。
protected ActionListener createButtonActionListener(int buttonIndex)
protected Object[] getButtons()
protected boolean getSizeButtonsToSameWidth()
protected int getInitialValueIndex()
protected void resetInputValue()
public void selectInitialValue(JOptionPane op)
selectInitialValue
方法重写,继承类
OptionPaneUI
public boolean containsCustomComponents(JOptionPane op)
containsCustomComponents
方法重写,继承类
OptionPaneUI
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.