Java javax.swing JOptionPane fields, constructors, methods, implement or subclass

Example usage for Java javax.swing JOptionPane fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for javax.swing JOptionPane.

The text is from its open source code.

Subclass

javax.swing.JOptionPane has subclasses.
Click this link to see all its subclasses.

Field

ObjectUNINITIALIZED_VALUE
Indicates that the user has not yet selected a value.
intDEFAULT_OPTION
Type meaning Look and Feel should not supply any options -- only use the options from the JOptionPane.
intYES_NO_OPTION
Type used for showConfirmDialog.
intYES_NO_CANCEL_OPTION
Type used for showConfirmDialog.
intOK_CANCEL_OPTION
Type used for showConfirmDialog.
intYES_OPTION
Return value from class method if YES is chosen.
intNO_OPTION
Return value from class method if NO is chosen.
intCANCEL_OPTION
Return value from class method if CANCEL is chosen.
intOK_OPTION
Return value form class method if OK is chosen.
intCLOSED_OPTION
Return value from class method if user closes window without selecting anything, more than likely this should be treated as either a CANCEL_OPTION or NO_OPTION.
intERROR_MESSAGE
Used for error messages.
intINFORMATION_MESSAGE
Used for information messages.
intWARNING_MESSAGE
Used for warning messages.
intQUESTION_MESSAGE
Used for questions.
intPLAIN_MESSAGE
No icon is used.
StringVALUE_PROPERTY
Bound property name for value.
StringINPUT_VALUE_PROPERTY
Bound property name for inputValue.

Constructor

JOptionPane(Object message, int messageType, int optionType)
Creates an instance of JOptionPane to display a message with the specified message type and options.
JOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue)
Creates an instance of JOptionPane to display a message with the specified message type, icon, and options, with the initially-selected option specified.
JOptionPane()
Creates a JOptionPane with a test message.
JOptionPane(Object message)
Creates a instance of JOptionPane to display a message using the plain-message message type and the default options delivered by the UI.
JOptionPane(Object message, int messageType)
Creates an instance of JOptionPane to display a message with the specified message type and the default options,
JOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options)
Creates an instance of JOptionPane to display a message with the specified message type, icon, and options.
JOptionPane(Object message, int messageType, int optionType, Icon icon)
Creates an instance of JOptionPane to display a message with the specified message type, options, and icon.

Method

voidaddPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.
voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property.
JDialogcreateDialog(Component parentComponent, String title)
Creates and returns a new JDialog wrapping this centered on the parentComponent in the parentComponent's frame.
JDialogcreateDialog(String title)
Creates and returns a new parentless JDialog with the specified title.
ColorgetBackground()
Gets the background color of this component.
Component[]getComponents()
Gets all the components in this container.
FramegetFrameForComponent(Component parentComponent)
Returns the specified component's Frame.
ObjectgetInputValue()
Returns the value the user has input, if wantsInput is true.
Object[]getOptions()
Returns the choices the user can make.
FramegetRootFrame()
Returns the Frame to use for the class methods in which a frame is not provided.
ObjectgetValue()
Returns the value the user has selected.
voidputClientProperty(Object key, Object value)
Adds an arbitrary key/value "client property" to this component.
voidselectInitialValue()
Requests that the initial value be selected, which will set focus to the initial value.
voidsetFont(Font font)
Sets the font for this component.
voidsetIcon(Icon newIcon)
Sets the icon to display.
voidsetInitialSelectionValue(Object newValue)
Sets the input value that is initially displayed as selected to the user.
voidsetInitialValue(Object newInitialValue)
Sets the initial value that is to be enabled -- the Component that has the focus when the pane is initially displayed.
voidsetInputValue(Object newValue)
Sets the input value that was selected or input by the user.
voidsetMessage(Object newMessage)
Sets the option pane's message-object.
voidsetMessageType(int newType)
Sets the option pane's message type.
voidsetOptions(Object[] newOptions)
Sets the options this pane displays.
voidsetOptionType(int newType)
Sets the options to display.
voidsetPreferredSize(Dimension preferredSize)
Sets the preferred size of this component.
voidsetRootFrame(Frame newRootFrame)
Sets the frame to use for class methods in which a frame is not provided.
voidsetValue(Object newValue)
Sets the value the user has chosen.
voidsetWantsInput(boolean newValue)
Sets the wantsInput property.
intshowConfirmDialog(Component parentComponent, Object message)
Brings up a dialog with the options Yes, No and Cancel; with the title, Select an Option.
intshowConfirmDialog(Component parentComponent, Object message, String title, int optionType)
Brings up a dialog where the number of choices is determined by the optionType parameter.
intshowConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType)
Brings up a dialog where the number of choices is determined by the optionType parameter, where the messageType parameter determines the icon to display.
intshowConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon)
Brings up a dialog with a specified icon, where the number of choices is determined by the optionType parameter.
ObjectshowInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue)
Prompts the user for input in a blocking dialog where the initial selection, possible selections, and all other options can be specified.
StringshowInputDialog(Object message)
Shows a question-message dialog requesting input from the user.
StringshowInputDialog(Component parentComponent, Object message, String title, int messageType)
Shows a dialog requesting input from the user parented to parentComponent with the dialog having the title title and message type messageType.
StringshowInputDialog(Object message, Object initialSelectionValue)
Shows a question-message dialog requesting input from the user, with the input value initialized to initialSelectionValue.
StringshowInputDialog(Component parentComponent, Object message)
Shows a question-message dialog requesting input from the user parented to parentComponent.
StringshowInputDialog(Component parentComponent, Object message, Object initialSelectionValue)
Shows a question-message dialog requesting input from the user and parented to parentComponent.
intshowInternalConfirmDialog(Component parentComponent, Object message)
Brings up an internal dialog panel with the options Yes, No and Cancel; with the title, Select an Option.
intshowInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType)
Brings up a internal dialog panel where the number of choices is determined by the optionType parameter.
intshowInternalConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType)
Brings up an internal dialog panel where the number of choices is determined by the optionType parameter, where the messageType parameter determines the icon to display.
StringshowInternalInputDialog(Component parentComponent, Object message)
Shows an internal question-message dialog requesting input from the user parented to parentComponent.
ObjectshowInternalInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue)
Prompts the user for input in a blocking internal dialog where the initial selection, possible selections, and all other options can be specified.
StringshowInternalInputDialog(Component parentComponent, Object message, String title, int messageType)
Shows an internal dialog requesting input from the user parented to parentComponent with the dialog having the title title and message type messageType.
voidshowInternalMessageDialog(Component parentComponent, Object message)
Brings up an internal confirmation dialog panel.
voidshowInternalMessageDialog(Component parentComponent, Object message, String title, int messageType)
Brings up an internal dialog panel that displays a message using a default icon determined by the messageType parameter.
intshowInternalOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)
Brings up an internal dialog panel with a specified icon, where the initial choice is determined by the initialValue parameter and the number of choices is determined by the optionType parameter.
voidshowMessageDialog(Component parentComponent, Object message)
Brings up an information-message dialog titled "Message".
voidshowMessageDialog(Component parentComponent, Object message, String title, int messageType)
Brings up a dialog that displays a message using a default icon determined by the messageType parameter.
voidshowMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon)
Brings up a dialog displaying a message, specifying all parameters.
intshowOptionDialog(Component parentComponent, Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)
Brings up a dialog with a specified icon, where the initial choice is determined by the initialValue parameter and the number of choices is determined by the optionType parameter.