Example usage for Java javax.swing JOptionPane fields, constructors, methods, implement or subclass
The text is from its open source code.
Object | UNINITIALIZED_VALUE Indicates that the user has not yet selected a value. |
int | DEFAULT_OPTION Type meaning Look and Feel should not supply any options -- only use the options from the JOptionPane . |
int | YES_NO_OPTION Type used for showConfirmDialog . |
int | YES_NO_CANCEL_OPTION Type used for showConfirmDialog . |
int | OK_CANCEL_OPTION Type used for showConfirmDialog . |
int | YES_OPTION Return value from class method if YES is chosen. |
int | NO_OPTION Return value from class method if NO is chosen. |
int | CANCEL_OPTION Return value from class method if CANCEL is chosen. |
int | OK_OPTION Return value form class method if OK is chosen. |
int | CLOSED_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 . |
int | ERROR_MESSAGE Used for error messages. |
int | INFORMATION_MESSAGE Used for information messages. |
int | WARNING_MESSAGE Used for warning messages. |
int | QUESTION_MESSAGE Used for questions. |
int | PLAIN_MESSAGE No icon is used. |
String | VALUE_PROPERTY Bound property name for value . |
String | INPUT_VALUE_PROPERTY Bound property name for inputValue . |
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. |
void | addPropertyChangeListener(PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list. |
void | addPropertyChangeListener(String propertyName, PropertyChangeListener listener) Adds a PropertyChangeListener to the listener list for a specific property. |
JDialog | createDialog(Component parentComponent, String title) Creates and returns a new JDialog wrapping this centered on the parentComponent in the parentComponent 's frame. |
JDialog | createDialog(String title) Creates and returns a new parentless JDialog with the specified title. |
Color | getBackground() Gets the background color of this component. |
Component[] | getComponents() Gets all the components in this container. |
Frame | getFrameForComponent(Component parentComponent) Returns the specified component's Frame . |
Object | getInputValue() Returns the value the user has input, if wantsInput is true. |
Object[] | getOptions() Returns the choices the user can make. |
Frame | getRootFrame() Returns the Frame to use for the class methods in which a frame is not provided. |
Object | getValue() Returns the value the user has selected. |
void | putClientProperty(Object key, Object value) Adds an arbitrary key/value "client property" to this component. |
void | selectInitialValue() Requests that the initial value be selected, which will set focus to the initial value. |
void | setFont(Font font) Sets the font for this component. |
void | setIcon(Icon newIcon) Sets the icon to display. |
void | setInitialSelectionValue(Object newValue) Sets the input value that is initially displayed as selected to the user. |
void | setInitialValue(Object newInitialValue) Sets the initial value that is to be enabled -- the Component that has the focus when the pane is initially displayed. |
void | setInputValue(Object newValue) Sets the input value that was selected or input by the user. |
void | setMessage(Object newMessage) Sets the option pane's message-object. |
void | setMessageType(int newType) Sets the option pane's message type. |
void | setOptions(Object[] newOptions) Sets the options this pane displays. |
void | setOptionType(int newType) Sets the options to display. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setRootFrame(Frame newRootFrame) Sets the frame to use for class methods in which a frame is not provided. |
void | setValue(Object newValue) Sets the value the user has chosen. |
void | setWantsInput(boolean newValue) Sets the wantsInput property. |
int | showConfirmDialog(Component parentComponent, Object message) Brings up a dialog with the options Yes, No and Cancel; with the title, Select an Option. |
int | showConfirmDialog(Component parentComponent, Object message, String title, int optionType) Brings up a dialog where the number of choices is determined by the optionType parameter. |
int | showConfirmDialog(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. |
int | showConfirmDialog(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. |
Object | showInputDialog(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. |
String | showInputDialog(Object message) Shows a question-message dialog requesting input from the user. |
String | showInputDialog(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 . |
String | showInputDialog(Object message, Object initialSelectionValue) Shows a question-message dialog requesting input from the user, with the input value initialized to initialSelectionValue . |
String | showInputDialog(Component parentComponent, Object message) Shows a question-message dialog requesting input from the user parented to parentComponent . |
String | showInputDialog(Component parentComponent, Object message, Object initialSelectionValue) Shows a question-message dialog requesting input from the user and parented to parentComponent . |
int | showInternalConfirmDialog(Component parentComponent, Object message) Brings up an internal dialog panel with the options Yes, No and Cancel; with the title, Select an Option. |
int | showInternalConfirmDialog(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. |
int | showInternalConfirmDialog(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. |
String | showInternalInputDialog(Component parentComponent, Object message) Shows an internal question-message dialog requesting input from the user parented to parentComponent . |
Object | showInternalInputDialog(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. |
String | showInternalInputDialog(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 . |
void | showInternalMessageDialog(Component parentComponent, Object message) Brings up an internal confirmation dialog panel. |
void | showInternalMessageDialog(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. |
int | showInternalOptionDialog(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. |
void | showMessageDialog(Component parentComponent, Object message) Brings up an information-message dialog titled "Message". |
void | showMessageDialog(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. |
void | showMessageDialog(Component parentComponent, Object message, String title, int messageType, Icon icon) Brings up a dialog displaying a message, specifying all parameters. |
int | showOptionDialog(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. |