public class JOptionPane extends JComponent implements Accessible
JOptionPane容易弹出一个标准的对话框提示用户输入一个值或告诉他们的东西。有关使用
JOptionPane信息看,
How to Make Dialogs,java教程中的一部分。
而JOptionPane类可能会出现复杂的方法众多,几乎所有使用本班一行调用其中的静态showXxxDialog方法如下所示:
这些方法也有
Method Name 描述 showConfirmDialog Asks a confirming question, like yes/no/cancel. showInputDialog Prompt for some input. showMessageDialog Tell the user about something that has happened. showOptionDialog The Grand Unification of the above three.
showInternalXXX风味,它使用一个内部的框架固定的对话框(见
JInternalFrame)。多个方便的方法也被定义-使用不同的参数列表的基本方法的重载版本。
所有的对话框是模态。每个showXxxDialog方法阻塞调用者直到用户的交互完成。
| icon | message |
| input value | |
| option buttons | |
ComponentOrientation财产。
参数:
参数,这些方法遵循一致的模式:
- parentComponent
- Defines the
Componentthat is to be the parent of this dialog box. It is used in two ways: theFramethat contains it is used as theFrameparent for the dialog box, and its screen coordinates are used in the placement of the dialog box. In general, the dialog box is placed just below the component. This parameter may benull, in which case a defaultFrameis used as the parent, and the dialog will be centered on the screen (depending on the L&F).- message
- A descriptive message to be placed in the dialog box. In the most common usage, message is just a
StringorStringconstant. However, the type of this parameter is actuallyObject. Its interpretation depends on its type:
- Object[]
- An array of objects is interpreted as a series of messages (one per object) arranged in a vertical stack. The interpretation is recursive -- each object in the array is interpreted according to its type.
- Component
- The
Componentis displayed in the dialog.- Icon
- The
Iconis wrapped in aJLabeland displayed in the dialog.- others
- The object is converted to a
Stringby calling itstoStringmethod. The result is wrapped in aJLabeland displayed.- messageType
- Defines the style of the message. The Look and Feel manager may lay out the dialog differently depending on this value, and will often provide a default icon. The possible values are:
ERROR_MESSAGEINFORMATION_MESSAGEWARNING_MESSAGEQUESTION_MESSAGEPLAIN_MESSAGE- optionType
- Defines the set of option buttons that appear at the bottom of the dialog box:
You aren't limited to this set of option buttons. You can provide any buttons you want using the options parameter.
DEFAULT_OPTIONYES_NO_OPTIONYES_NO_CANCEL_OPTIONOK_CANCEL_OPTION- options
- A more detailed description of the set of option buttons that will appear at the bottom of the dialog box. The usual value for the options parameter is an array of
Strings. But the parameter type is an array ofObjects. A button is created for each object depending on its type:
- Component
- The component is added to the button row directly.
- Icon
- A
JButtonis created with this as its label.- other
- The
Objectis converted to a string using itstoStringmethod and the result is used to label aJButton.- icon
- A decorative icon to be placed in the dialog box. A default value for this is determined by the
messageTypeparameter.- title
- The title for the dialog box.
- initialValue
- The default selection (input value).
当选择改变,setValue被调用时,产生一个PropertyChangeEvent。
如果一个JOptionPane配置了所有的输入setWantsInput绑定属性JOptionPane.INPUT_VALUE_PROPERTY也可以听,确定当用户输入或选择一个值。
当一个人的showXxxDialog方法返回一个整数,可能的值:
YES_OPTIONNO_OPTIONCANCEL_OPTIONOK_OPTIONCLOSED_OPTION JOptionPane.showMessageDialog(null, "alert", "alert", JOptionPane.ERROR_MESSAGE);
JOptionPane。showinternalmessagedialog(框架,“信息”,“信息”,JOptionPane information_message);
showconfirmdialog JOptionPane(null,“选择”,“选择”,JOptionPane yes_no_option);
showinternalconfirmdialog JOptionPane(框架,“请选择一个”,“信息”,joptionpane.yes_no_cancel_option,JOptionPane information_message);
对象[ ]选项= {“确定”,“取消”};JOptionPane。showoptiondialog(null,单击“确定”继续”,“警告”,joptionpane.default_option,joptionpane.warning_message,无效,选项,选项[ 0 ]);
String inputValue = JOptionPane.showInputDialog("Please input a value");
对象[ ]可能的值= {“第一”、“二”、“第三”
};对象SelectedValue = JOptionPane。showinputdialog(null,“选择一个”,“输入”,joptionpane.information_message,空,可能的值,可能的值[ 0 ]);
JOptionPane,标准模式大致如下:
JOptionPane窗格=新的JOptionPane(争论);窗格。集。XXXX(…);/ /配置JDialog对话框=窗格。createdialog(parentcomponent,标题);show()对话框;对象getvalue() SelectedValue =窗格;如果(SelectedValue = = null)返回closed_option;/如果有不选项按钮的数组:如果(选项= =无效)如果(SelectedValue是整数)返回((整数)intvalue() SelectedValue);返回closed_option;}如果有一个选项按钮数组:为(int计数器= 0,maxcounter = options.length;反< maxcounter;计数器++){如果(选项[反]。等于(SelectedValue))返回柜台;}返回closed_option;
警告: Swing是线程不安全的。更多信息见Swing's Threading Policy。
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans包。请看XMLEncoder。
JInternalFrame
| Modifier and Type | Class and Description |
|---|---|
protected class |
JOptionPane.AccessibleJOptionPane
这个类实现了对
JOptionPane类可访问性支持。
|
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
CANCEL_OPTION
如果选择取消选择,则类方法的返回值。
|
static int |
CLOSED_OPTION
如果用户关闭窗口而不选择任何返回类的方法的价值,更应该被视为一个
CANCEL_OPTION或
NO_OPTION。
|
static int |
DEFAULT_OPTION
类型意义的外观和感觉,不应该提供任何选项,只使用从
JOptionPane选项。
|
static int |
ERROR_MESSAGE
用于错误消息。
|
protected Icon |
icon
窗格中使用的图标。
|
static String |
ICON_PROPERTY
绑定属性的名称
icon。
|
static int |
INFORMATION_MESSAGE
用于信息消息。
|
static String |
INITIAL_SELECTION_VALUE_PROPERTY
绑定属性的名称
initialSelectionValue。
|
static String |
INITIAL_VALUE_PROPERTY
绑定属性的名称
initialValue。
|
protected Object |
initialSelectionValue
选择在
selectionValues初始值。
|
protected Object |
initialValue
值,应在
options初步选定。
|
static String |
INPUT_VALUE_PROPERTY
绑定属性的名称
inputValue。
|
protected Object |
inputValue
值用户输入的。
|
protected Object |
message
信息显示。
|
static String |
MESSAGE_PROPERTY
绑定属性的名称
message。
|
static String |
MESSAGE_TYPE_PROPERTY
绑定属性的名称
type。
|
protected int |
messageType
消息类型。
|
static int |
NO_OPTION
如果没有选择的类方法返回值。
|
static int |
OK_CANCEL_OPTION
用于
showConfirmDialog型。
|
static int |
OK_OPTION
如果选择确定的话,返回值形式类方法。
|
static String |
OPTION_TYPE_PROPERTY
绑定属性的名称
optionType。
|
protected Object[] |
options
显示给用户的选项。
|
static String |
OPTIONS_PROPERTY
绑定属性的名称
option。
|
protected int |
optionType
选择类型,一个
DEFAULT_OPTION,
YES_NO_OPTION,
YES_NO_CANCEL_OPTION或
OK_CANCEL_OPTION。
|
static int |
PLAIN_MESSAGE
没有使用图标。
|
static int |
QUESTION_MESSAGE
用于问题。
|
static String |
SELECTION_VALUES_PROPERTY
绑定属性的名称
selectionValues。
|
protected Object[] |
selectionValues
用户可以从中选择的值数组。
|
static Object |
UNINITIALIZED_VALUE
指示用户尚未选择一个值。
|
protected Object |
value
目前选择的价值,将是一个有效的选项,或
UNINITIALIZED_VALUE或
null。
|
static String |
VALUE_PROPERTY
绑定属性的名称
value。
|
static String |
WANTS_INPUT_PROPERTY
绑定属性的名称
wantsInput。
|
protected boolean |
wantsInput
如果是真的,一个用户界面部件将被提供给用户输入。
|
static int |
WARNING_MESSAGE
用于警告消息。
|
static int |
YES_NO_CANCEL_OPTION
用于
showConfirmDialog型。
|
static int |
YES_NO_OPTION
用于
showConfirmDialog型。
|
static int |
YES_OPTION
如果是选择的话,从类方法返回值。
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
JOptionPane()
创建一个测试消息
JOptionPane。
|
JOptionPane(Object message)
创建一个实例
JOptionPane使用明文的消息的消息类型和默认选项的界面传递的消息显示。
|
JOptionPane(Object message, int messageType)
创建
JOptionPane与指定的消息类型、消息显示实例的默认选项,
|
JOptionPane(Object message, int messageType, int optionType)
创建
JOptionPane与指定的消息类型和选项的信息显示的一个实例。
|
JOptionPane(Object message, int messageType, int optionType, Icon icon)
创建
JOptionPane与指定的消息类型、消息显示实例的选项,和图标。
|
JOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options)
创建
JOptionPane与指定的消息类型、消息显示一个图标,并选择。
|
JOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue)
创建
JOptionPane与指定的消息类型、消息显示一个图标,并选择,与最初选择的选项指定。
|
| Modifier and Type | Method and Description |
|---|---|
JDialog |
createDialog(Component parentComponent, String title)
创建并返回一个新的
JDialog包装
this围绕在
parentComponent的框架
parentComponent。
|
JDialog |
createDialog(String title)
创建并返回一个新的父母
JDialog指定标题的。
|
JInternalFrame |
createInternalFrame(Component parentComponent, String title)
创建并返回
JInternalFrame实例。
|
AccessibleContext |
getAccessibleContext()
返回与此相关的
AccessibleContext JOptionPane。
|
static JDesktopPane |
getDesktopPaneForComponent(Component parentComponent)
返回指定组件的桌面窗格。
|
static Frame |
getFrameForComponent(Component parentComponent)
返回指定组件的
Frame。
|
Icon |
getIcon()
返回此窗格显示的图标。
|
Object |
getInitialSelectionValue()
返回显示为最初选择给用户的输入值。
|
Object |
getInitialValue()
返回初始值。
|
Object |
getInputValue()
返回用户输入的值,如果
wantsInput是真实的。
|
int |
getMaxCharactersPerLineCount()
返回消息中的行上的最大字符数。
|
Object |
getMessage()
返回此窗格显示的消息对象。
|
int |
getMessageType()
返回消息类型。
|
Object[] |
getOptions()
返回用户可以作出的选择。
|
int |
getOptionType()
返回显示的选项的类型。
|
static Frame |
getRootFrame()
返回
Frame使用类方法的框架没有提供。
|
Object[] |
getSelectionValues()
返回输入选择值。
|
OptionPaneUI |
getUI()
返回实现该组件的“L”的用户界面对象。
|
String |
getUIClassID()
返回实现此组件的“为”的“用户界面”类的名称。
|
Object |
getValue()
返回用户已选择的值。
|
boolean |
getWantsInput()
返回的
wantsInput属性的值。
|
protected String |
paramString()
返回该
JOptionPane字符串表示形式。
|
void |
selectInitialValue()
请选择初始值,该值将集中到初始值。
|
void |
setIcon(Icon newIcon)
设置图标显示。
|
void |
setInitialSelectionValue(Object newValue)
设置最初显示为选定给用户的输入值。
|
void |
setInitialValue(Object newInitialValue)
设置初始值,可以实现--
Component具有焦点时,最初显示的窗格。
|
void |
setInputValue(Object newValue)
设置由用户选择或输入的输入值。
|
void |
setMessage(Object newMessage)
设置选项窗格的消息对象。
|
void |
setMessageType(int newType)
设置选项窗格的消息类型。
|
void |
setOptions(Object[] newOptions)
设置此窗格显示的选项。
|
void |
setOptionType(int newType)
设置显示的选项。
|
static void |
setRootFrame(Frame newRootFrame)
设置不提供帧的类方法的框架。
|
void |
setSelectionValues(Object[] newValues)
设置一个窗格的输入选择值,为用户提供一个要选择的项目列表的列表。
|
void |
setUI(OptionPaneUI ui)
设置为该组件实现的“L”的用户界面对象。
|
void |
setValue(Object newValue)
设置用户已选择的值。
|
void |
setWantsInput(boolean newValue)
集
wantsInput财产。
|
static int |
showConfirmDialog(Component parentComponent, Object message)
提出了一是的对话框选项,不和取消;的称号,
选择一个选项。
|
static int |
showConfirmDialog(Component parentComponent, Object message, String title, int optionType)
提出了一个对话框,选择的数量是由
optionType参数确定。
|
static int |
showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType)
提出了一个对话框,选择的数量是由
optionType参数决定,在
messageType参数确定要显示的图标。
|
static int |
showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon)
提出了一种具有指定图标的对话框,这里选择的数量是由
optionType参数确定。
|
static String |
showInputDialog(Component parentComponent, Object message)
显示问题的消息对话框要求用户输入
parentComponent父。
|
static String |
showInputDialog(Component parentComponent, Object message, Object initialSelectionValue)
显示问题的消息对话框要求用户输入和父
parentComponent。
|
static String |
showInputDialog(Component parentComponent, Object message, String title, int messageType)
显示一个对话框,要求用户输入的对话框的父
parentComponent有标题和消息类型
messageType
title。
|
static Object |
showInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue)
提示用户在一个阻塞对话框中输入初始选择,可能的选择,和所有其他选项可以指定。
|
static String |
showInputDialog(Object message)
显示一个从用户请求输入的问题消息对话框。
|
static String |
showInputDialog(Object message, Object initialSelectionValue)
显示问题的消息对话框要求用户输入,与输入的值初始化为
initialSelectionValue。
|
static int |
showInternalConfirmDialog(Component parentComponent, Object message)
提出了选择是的内部对话面板,不和取消;的称号,
选择一个选项。
|
static int |
showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType)
提出了一种内部对话面板上选择的数量是由
optionType参数确定。
|
static int |
showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType)
提出了一个内部对话面板上选择的数量是由
optionType参数决定,在
messageType参数确定要显示的图标。
|
static int |
showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon)
提出了用指定的图标内部对话面板,在选择的数量是由
optionType参数确定。
|
static String |
showInternalInputDialog(Component parentComponent, Object message)
显示内部问题消息对话框要求用户输入
parentComponent父。
|
static String |
showInternalInputDialog(Component parentComponent, Object message, String title, int messageType)
显示内部对话请求从用户输入
parentComponent父与对话框有标题和消息类型
messageType
title。
|
static Object |
showInternalInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue)
提示用户在一个阻塞的内部对话框中输入的输入,在初始选择,可能的选择,和所有其他选项可以指定。
|
static void |
showInternalMessageDialog(Component parentComponent, Object message)
弹出内部确认对话框。
|
static void |
showInternalMessageDialog(Component parentComponent, Object message, String title, int messageType)
提出了一种显示消息使用由
messageType参数确定的默认图标的内部对话面板。
|
static void |
showInternalMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon)
调出一个显示消息的内部对话框,指定所有参数。
|
static int |
showInternalOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)
提出了用指定的图标内部对话面板,在最初的选择是由
initialValue参数和选择的数量决定的
optionType参数确定。
|
static void |
showMessageDialog(Component parentComponent, Object message)
提出了一个名为“消息”的信息消息对话框。
|
static void |
showMessageDialog(Component parentComponent, Object message, String title, int messageType)
将弹出一个对话框,显示一条消息,使用由
messageType参数确定的默认图标。
|
static void |
showMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon)
显示一个对话框,显示一个消息,指定所有参数。
|
static int |
showOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)
提出了一种用指定的图标对话框,在最初的选择是由
initialValue参数和选择的数量决定的
optionType参数确定。
|
void |
updateUI()
从
UIManager,L和F改变通知。
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final Object UNINITIALIZED_VALUE
public static final int DEFAULT_OPTION
JOptionPane选项。
public static final int YES_NO_OPTION
showConfirmDialog型。
public static final int YES_NO_CANCEL_OPTION
showConfirmDialog型。
public static final int OK_CANCEL_OPTION
showConfirmDialog型。
public static final int YES_OPTION
public static final int NO_OPTION
public static final int CANCEL_OPTION
public static final int OK_OPTION
public static final int CLOSED_OPTION
CANCEL_OPTION或
NO_OPTION。
public static final int ERROR_MESSAGE
public static final int INFORMATION_MESSAGE
public static final int WARNING_MESSAGE
public static final int QUESTION_MESSAGE
public static final int PLAIN_MESSAGE
public static final String ICON_PROPERTY
icon。
public static final String MESSAGE_PROPERTY
message。
public static final String VALUE_PROPERTY
value。
public static final String OPTIONS_PROPERTY
option。
public static final String INITIAL_VALUE_PROPERTY
initialValue。
public static final String MESSAGE_TYPE_PROPERTY
type。
public static final String OPTION_TYPE_PROPERTY
optionType。
public static final String SELECTION_VALUES_PROPERTY
selectionValues。
public static final String INITIAL_SELECTION_VALUE_PROPERTY
initialSelectionValue。
public static final String INPUT_VALUE_PROPERTY
inputValue。
public static final String WANTS_INPUT_PROPERTY
wantsInput。
protected transient Icon icon
protected transient Object message
protected transient Object[] options
protected transient Object initialValue
options初步选定。
protected int messageType
protected int optionType
DEFAULT_OPTION,
YES_NO_OPTION,
YES_NO_CANCEL_OPTION或
OK_CANCEL_OPTION。
protected transient Object value
UNINITIALIZED_VALUE或
null。
protected transient Object[] selectionValues
protected transient Object inputValue
protected transient Object initialSelectionValue
selectionValues初始值。
protected boolean wantsInput
public JOptionPane()
JOptionPane。
public JOptionPane(Object message)
JOptionPane使用明文的消息的消息类型和默认选项的界面传递的消息显示。
message -
Object显示
public JOptionPane(Object message, int messageType)
JOptionPane与指定的消息类型、消息显示实例的默认选项,
message -
Object显示
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
public JOptionPane(Object message, int messageType, int optionType)
JOptionPane与指定的消息类型和选项的信息显示的一个实例。
message -
Object显示
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
optionType -在窗格中显示的选项:
DEFAULT_OPTION,
YES_NO_OPTION,
YES_NO_CANCEL_OPTION,
OK_CANCEL_OPTION
public JOptionPane(Object message, int messageType, int optionType, Icon icon)
JOptionPane与指定的消息类型、消息显示实例的选项,和图标。
message -
Object显示
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
optionType -在窗格中显示的选项:
DEFAULT_OPTION,
YES_NO_OPTION,
YES_NO_CANCEL_OPTION,
OK_CANCEL_OPTION
icon -显示
Icon图像
public JOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options)
JOptionPane与指定的消息类型、消息显示一个图标,并选择。最初选择的选项没有。
选择对象应包含实例Components,(这是直接添加)或Strings(这是包裹在一个JButton)。如果你提供Components,你必须确保当Component是它的消息setValue在创建JOptionPane点击。
message -
Object显示
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
optionType -在窗格中显示的选项:
DEFAULT_OPTION,
YES_NO_OPTION,
YES_NO_CANCEL_OPTION,
OK_CANCEL_OPTION
icon -显示
Icon图像
options的选择,用户可以选择
public JOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue)
JOptionPane与指定的消息类型、消息显示一个图标,并选择,与最初选择的选项指定。
message -
Object显示
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
optionType -在窗格中显示的选项:
DEFAULT_OPTION,
YES_NO_OPTION,
YES_NO_CANCEL_OPTION,
OK_CANCEL_OPTION
icon -图标显示
options的选择,用户可以选择
initialValue,最初选择的选择;如果
null,然后将初步选定;如果
options是唯一有意义的
public static String showInputDialog(Object message) throws HeadlessException
message -
Object显示
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static String showInputDialog(Object message, Object initialSelectionValue)
initialSelectionValue。该对话框使用默认的框架,这通常意味着它是集中在屏幕上。
message -
Object显示
initialSelectionValue -用于初始化输入字段的值
public static String showInputDialog(Component parentComponent, Object message) throws HeadlessException
parentComponent父。该对话框显示在顶部的
Component的框架,通常位于
Component。
parentComponent为对话框的父
Component
message -
Object显示
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static String showInputDialog(Component parentComponent, Object message, Object initialSelectionValue)
parentComponent。输入的值将被初始化为
initialSelectionValue,对话框显示在顶部的
Component的框架,通常位于
Component。
parentComponent为对话框的父
Component
message -
Object显示
initialSelectionValue -用于初始化输入字段的值
public static String showInputDialog(Component parentComponent, Object message, String title, int messageType) throws HeadlessException
parentComponent有标题和消息类型
messageType
title。
parentComponent为对话框的父
Component
message -
Object显示
title -
String在对话框标题栏中显示
messageType -的信息,要显示的类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static Object showInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue) throws HeadlessException
selectionValues,哪里
null意味着用户可以输入任何他们希望的,通常由一个
JTextField手段。
initialSelectionValue是提示用户与初始值。它是由用户决定如何最好地代表
selectionValues,但通常一个
JComboBox,
JList,或
JTextField将使用。
parentComponent为对话框的父
Component
message -
Object显示
title -
String在对话框标题栏中显示
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
icon -显示
Icon图像
selectionValues -
Objects给可能的选项数组
initialSelectionValue -用于初始化输入字段的值
null意义用户取消输入
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static void showMessageDialog(Component parentComponent, Object message) throws HeadlessException
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -
Object显示
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType) throws HeadlessException
messageType参数确定的默认图标。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -
Object显示
title -对话框标题的字符串
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon) throws HeadlessException
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -
Object显示
title -对话框标题的字符串
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
icon -图标的对话框,帮助用户识别信息显示的一种显示
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static int showConfirmDialog(Component parentComponent, Object message) throws HeadlessException
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -
Object显示
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType) throws HeadlessException
optionType参数确定。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -
Object显示
title -对话框标题的字符串
optionType - int指定对话框上的选项:
YES_NO_OPTION,
YES_NO_CANCEL_OPTION,或
OK_CANCEL_OPTION
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType) throws HeadlessException
optionType参数决定,在
messageType参数确定要显示的图标。的
messageType参数主要是用来提供一个默认图标的外观和感觉。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame。
message -
Object显示
title -对话框标题的字符串
optionType整数指定对话框上的选项:
YES_NO_OPTION,
YES_NO_CANCEL_OPTION,或
OK_CANCEL_OPTION
messageType整数指定消息,这是一种;主要用于确定图标的可插拔的感觉:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon) throws HeadlessException
optionType参数确定。的
messageType参数主要是用来提供一个默认图标的外观和感觉。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -显示对象
title -对话框标题的字符串
optionType - int指定对话框上的选项:
YES_NO_OPTION,
YES_NO_CANCEL_OPTION,或
OK_CANCEL_OPTION
messageType - int指定消息,这是一种,主要用于确定图标的可插拔的感觉:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
icon -在对话框中显示的图标
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static int showOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue) throws HeadlessException
initialValue参数和选择的数量决定的
optionType参数确定。
如果optionType是YES_NO_OPTION,或YES_NO_CANCEL_OPTION和options参数null,然后选择是由看提供的感觉。
的messageType参数主要是用来提供一个默认图标的外观和感觉。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -
Object显示
title -对话框标题的字符串
optionType整数指定对话框上的选项:
DEFAULT_OPTION,
YES_NO_OPTION,
YES_NO_CANCEL_OPTION,或
OK_CANCEL_OPTION
messageType整数指定的消息,这是一种,主要用于确定图标的可插拔的感觉:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
icon -在对话框中显示的图标
options -对象指示可能的选择,用户可以进行数组;如果对象是组件,他们正确地呈现;非
String对象使用他们的
toString方法呈现;如果该参数为
null,选项的确定和感觉一下
initialValue -表示该对话框的默认选择的对象;如果
options是唯一有意义的使用;可以
null
CLOSED_OPTION如果用户关闭对话框
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public JDialog createDialog(Component parentComponent, String title) throws HeadlessException
JDialog包装
this围绕在
parentComponent的框架
parentComponent。
title是返回对话框的标题。返回的
JDialog不会由用户调整大小,但是程序可以调用
setResizable在
JDialog实例更改此属性。返回的
JDialog将等设置,一旦它被关闭,或者用户点击一个按钮,这optionpane的价值属性将设置相应的对话框将关闭。每一次的对话是可见的,它将重置选项窗格中的价值属性
JOptionPane.UNINITIALIZED_VALUE确保用户的后续行动,关闭对话框正确。
parentComponent决定框架中显示对话框;如果
parentComponent没有
Frame,默认是使用
Frame
title -对话框标题的字符串
JDialog包含此实例
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public JDialog createDialog(String title) throws HeadlessException
JDialog指定标题的。返回的
JDialog不会由用户调整大小,但是程序可以调用
setResizable在
JDialog实例更改此属性。返回的
JDialog将等设置,一旦它被关闭,或者用户点击一个按钮,这optionpane的价值属性将设置相应的对话框将关闭。每一次的对话是可见的,它会选择窗格的价值属性重置为
JOptionPane.UNINITIALIZED_VALUE确保用户的后续行动,关闭对话框正确。
title -对话框标题的字符串
JDialog包含此实例
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
GraphicsEnvironment.isHeadless()
public static void showInternalMessageDialog(Component parentComponent, Object message)
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -显示对象
public static void showInternalMessageDialog(Component parentComponent, Object message, String title, int messageType)
messageType参数确定的默认图标的内部对话面板。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -
Object显示
title -对话框标题的字符串
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
public static void showInternalMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon)
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -
Object显示
title -对话框标题的字符串
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
icon -图标的对话框,帮助用户识别信息显示的一种显示
public static int showInternalConfirmDialog(Component parentComponent, Object message)
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -
Object显示
public static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType)
optionType参数确定。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -在对话框中显示的对象;一个
Component对象呈现为
Component;一
String对象呈现为一个字符串;其他对象转换为一个
String使用
toString方法
title -对话框标题的字符串
optionType整数指定对话框上的选项:
YES_NO_OPTION,或
YES_NO_CANCEL_OPTION
public static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType)
optionType参数决定,在
messageType参数确定要显示的图标。的
messageType参数主要是用来提供一个默认图标的外观和感觉。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -在对话框中显示的对象;一个
Component对象呈现为
Component;一
String对象呈现为一个字符串;其他对象转换为一个
String使用
toString方法
title -对话框标题的字符串
optionType整数指定对话框上的选项:
YES_NO_OPTION,或
YES_NO_CANCEL_OPTION
messageType整数指定的消息,这是一种,主要用于确定图标的可插拔的感觉:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
public static int showInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon)
optionType参数确定。的
messageType参数主要是用来提供一个默认图标的外观和感觉。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果parentcomponent没有边框,默认是使用
Frame
message -在对话框中显示的对象;一个
Component对象呈现为
Component;一
String对象呈现为一个字符串;其他对象转换为一个
String使用
toString方法
title -对话框标题的字符串
optionType整数指定对话框上的选项:
YES_NO_OPTION,或
YES_NO_CANCEL_OPTION。
messageType整数指定的消息,这是一种,主要用于确定图标的可插拔的感觉:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
icon -在对话框中显示的图标
public static int showInternalOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)
initialValue参数和选择的数量决定的
optionType参数确定。
如果optionType是YES_NO_OPTION,或YES_NO_CANCEL_OPTION和options参数null,然后选择是由看提供的感觉。
的messageType参数主要是用来提供一个默认图标的外观和感觉。
parentComponent -确定
Frame该对话框显示;如果
null,或者如果
parentComponent没有
Frame,默认是使用
Frame
message -在对话框中显示的对象;一个
Component对象呈现为
Component;一
String对象呈现为一个字符串。其他对象转换为一个
String使用
toString方法
title -对话框标题的字符串
optionType整数指定对话框上的选项:
YES_NO_OPTION,或
YES_NO_CANCEL_OPTION
messageType整数指定消息,这是一种;主要用于确定图标的可插拔的感觉:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
icon -在对话框中显示的图标
options -对象指示可能的选择,用户可以进行数组;如果对象是组件,他们正确地呈现;非
String对象使用他们的
toString方法呈现;如果该参数为
null,选项的确定和感觉一下
initialValue -表示该对话框的默认选择的对象;如果
options是唯一有意义的使用;可以
null
CLOSED_OPTION如果用户关闭对话框
public static String showInternalInputDialog(Component parentComponent, Object message)
parentComponent父。对话是在
Component框架显示,通常位于
Component。
parentComponent为对话框的父
Component
message -
Object显示
public static String showInternalInputDialog(Component parentComponent, Object message, String title, int messageType)
parentComponent父与对话框有标题和消息类型
messageType
title。
parentComponent为对话框的父
Component
message -
Object显示
title -
String在对话框标题栏中显示
messageType -的信息,要显示的类型:error_message,information_message,warning_message,question_message,或plain_message
public static Object showInternalInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue)
selectionValues,哪里
null意味着用户可以输入任何他们希望的,通常由一个
JTextField手段。
initialSelectionValue是提示用户与初始值。它是由用户决定如何最好地代表
selectionValues,但通常一个
JComboBox,
JList,或
JTextField将使用。
parentComponent为对话框的父
Component
message -
Object显示
title -
String在对话框标题栏中显示
messageType -显示的消息类型:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
icon -
Icon图像显示
selectionValues -
Objects给可能的选项数组
initialSelectionValue -用于初始化输入字段的值
null意义用户取消输入
public JInternalFrame createInternalFrame(Component parentComponent, String title)
JInternalFrame实例。内部框架指定标题的创建,和包装的
JOptionPane。返回的
JInternalFrame添加到
parentComponent的
JDesktopPane祖先,或成分的母如果一个祖先不是
JDesktopPane,或者如果
parentComponent没有父母那么
RuntimeException抛出。
parentComponent -内部控制框架的父
Component
title -
String在框架的标题栏显示
JInternalFrame含有
JOptionPane
RuntimeException -如果
parentComponent没有有效的父
public static Frame getFrameForComponent(Component parentComponent) throws HeadlessException
Frame。
parentComponent -
Component检查一
Frame
Frame,或
getRootFrame如果组件是
null,或没有有效的
Frame母
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
getRootFrame(),
GraphicsEnvironment.isHeadless()
public static JDesktopPane getDesktopPaneForComponent(Component parentComponent)
parentComponent -
Component检查桌面
JDesktopPane,或
null如果组件是
null或没有一个祖先,一个
JInternalFrame
public static void setRootFrame(Frame newRootFrame)
注:建议而不是使用这种方法,你提供一个有效的父。
newRootFrame -使用默认的
Frame
public static Frame getRootFrame() throws HeadlessException
Frame使用类方法的框架没有提供。
Frame
HeadlessException -如果
GraphicsEnvironment.isHeadless返回
true
setRootFrame(java.awt.Frame),
GraphicsEnvironment.isHeadless()
public void setUI(OptionPaneUI ui)
ui -
OptionPaneUI L和F的对象
UIDefaults.getUI(javax.swing.JComponent)
public OptionPaneUI getUI()
OptionPaneUI对象
public void updateUI()
UIManager,L和F改变通知。从
UIManager最新版本替换当前的UI对象。
updateUI 方法重写,继承类
JComponent
JComponent.updateUI()
public String getUIClassID()
getUIClassID 方法重写,继承类
JComponent
JComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)
public void setMessage(Object newMessage)
newMessage -
Object显示
getMessage()
public Object getMessage()
Object显示
setMessage(java.lang.Object)
public void setIcon(Icon newIcon)
null,看起来感觉不提供一个图标。
newIcon -
Icon显示
getIcon()
public Icon getIcon()
Icon显示
setIcon(javax.swing.Icon)
public void setValue(Object newValue)
newValue -选择的价值
getValue()
public Object getValue()
UNINITIALIZED_VALUE意味着用户还没有作出选择,
null意味着用户不选择任何关闭窗口。否则,返回的值将是在这个对象中定义的选项之一。
Object,
UNINITIALIZED_VALUE如果用户尚未作出选择,或
null如果用户关闭窗口没有做出选择
setValue(java.lang.Object)
public void setOptions(Object[] newOptions)
newOptions元素是一种
Component是直接添加到面板中,否则一个按钮元素的创建。
newOptions -
Objects创建按钮,用户可以点击一个数组,或任意
Components添加到面板
getOptions()
public Object[] getOptions()
Objects,给用户的选择
setOptions(java.lang.Object[])
public void setInitialValue(Object newInitialValue)
Component具有焦点时,最初显示的窗格。
newInitialValue,获取初始键盘焦点的
Object
getInitialValue()
public Object getInitialValue()
Object初始
setInitialValue(java.lang.Object)
public void setMessageType(int newType)
parentComponent。
newType指定消息显示类的整数:
ERROR_MESSAGE,
INFORMATION_MESSAGE,
WARNING_MESSAGE,
QUESTION_MESSAGE,或
PLAIN_MESSAGE
RuntimeException -如果
newType不是上面列出的法律价值
getMessageType()
public int getMessageType()
setMessageType(int)
public void setOptionType(int newType)
newType指定选项的L和F是显示一个整数:
DEFAULT_OPTION,
YES_NO_OPTION,
YES_NO_CANCEL_OPTION,或
OK_CANCEL_OPTION
RuntimeException -如果
newType不是上面列出的法律价值
getOptionType(),
setOptions(java.lang.Object[])
public int getOptionType()
setOptionType(int)
public void setSelectionValues(Object[] newValues)
null值意味着用户可以输入任何他们希望的,通常由一个
JTextField
集wantsInput真实。使用setInitialSelectionValue指定最初选择的价值。该窗格被启用后,inputValue设置为用户选择的价值。
newValues -一系列的
Objects用户显示(通常在一个列表或组合框)用户可以从中进行选择
setWantsInput(boolean),
setInitialSelectionValue(java.lang.Object),
getSelectionValues()
public Object[] getSelectionValues()
Objects阵列的用户可以选择
setSelectionValues(java.lang.Object[])
public void setInitialSelectionValue(Object newValue)
wantsInput是真实的。
newValue -最初选择的价值
setSelectionValues(java.lang.Object[]),
getInitialSelectionValue()
public Object getInitialSelectionValue()
public void setInputValue(Object newValue)
wantsInput是真实的。请注意,此方法在“选项”窗格(响应用户操作)内部调用,一般不被客户端程序调用。设置输入值最初显示为选定的用户,使用
setInitialSelectionValue。
newValue -用于设置值,用户指定的
Object(通常在一个文本字段)
setSelectionValues(java.lang.Object[]),
setInitialSelectionValue(java.lang.Object),
setWantsInput(boolean),
getInputValue()
public Object getInputValue()
wantsInput是真实的。
Object用户指定的,如果它是一个对象,或
String如果它是一个值类型为一场
setSelectionValues(java.lang.Object[]),
setWantsInput(boolean),
setInputValue(java.lang.Object)
public int getMaxCharactersPerLineCount()
Integer.MAX_VALUE。值可以通过重写这个方法在子类中改变。
public void setWantsInput(boolean newValue)
wantsInput财产。如果
newValue是真实的,一个输入部件(如文本框或组合框)的母
parentComponent是提供让用户输入一个值。如果
getSelectionValues返回非
null阵列,输入值是一个指向数组中的对象。否则,输入值是任何用户输入的。
这是一个绑定属性。
public boolean getWantsInput()
wantsInput属性的值。
setWantsInput(boolean)
public void selectInitialValue()
protected String paramString()
JOptionPane字符串表示形式。此方法仅用于调试目的,返回的字符串的内容和格式可能会在实现过程中有所不同。返回的字符串是空的但可能不
null。
paramString 方法重写,继承类
JComponent
JOptionPane字符串表示形式
public AccessibleContext getAccessibleContext()
AccessibleContext JOptionPane。可供选择的
AccessibleContext窗格,以一个
AccessibleJOptionPane形式。一个新的
AccessibleJOptionPane实例被创建时。
getAccessibleContext 接口
Accessible
getAccessibleContext 方法重写,继承类
Component
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.