public enum JOptionPane2 extends Enum<JOptionPane2>
JOptionPane
Modifier and Type | Method and Description |
---|---|
static Optional<String> |
showInputDialog(@Nullable Component parentComponent,
Object message)
Shows a question-message dialog requesting input from the user parented to
parentComponent . |
static Optional<String> |
showInputDialog(@Nullable Component parentComponent,
Object message,
Object initialSelectionValue)
Shows a question-message dialog requesting input from the user and parented to
parentComponent . |
static Optional<String> |
showInputDialog(@Nullable 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 . |
static <T> Optional<T> |
showInputDialog(@Nullable Component parentComponent,
Object message,
String title,
int messageType,
Icon icon,
T[] selectionValues,
T initialSelectionValue)
Prompts the user for input in a blocking dialog where the initial selection, possible selections, and all other options can be specified.
|
static Optional<String> |
showInputDialog(Object message)
Shows a question-message dialog requesting input from the user.
|
static Optional<String> |
showInputDialog(Object message,
Object initialSelectionValue)
Shows a question-message dialog requesting input from the user, with the input value initialized to
initialSelectionValue . |
static Optional<char[]> |
showPasswordDialog(@Nullable Component parentComponent,
Object message)
Shows a question-message dialog requesting a passphrase or password input from the user parented to
parentComponent . |
static Optional<char[]> |
showPasswordDialog(@Nullable 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 . |
static Optional<char[]> |
showPasswordDialog(Object message)
Shows a question-message dialog requesting a passphrase or password input from the user.
|
static JOptionPane2 |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static JOptionPane2[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static JOptionPane2[] values()
for (JOptionPane2 c : JOptionPane2.values()) System.out.println(c);
public static JOptionPane2 valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static Optional<char[]> showPasswordDialog(Object message)
message
- the Object
to displayOptional
holding the password if the dialog was confirmed, otherwise Optional.empty()
.HeadlessException
- if GraphicsEnvironment.isHeadless
returns true
GraphicsEnvironment.isHeadless()
public static Optional<char[]> showPasswordDialog(@Nullable @Nullable Component parentComponent, Object message)
parentComponent
.
The dialog is displayed on top of the Component
's frame, and is usually positioned below the Component
.parentComponent
- the parent Component
for the dialogmessage
- the Object
to displayOptional
holding the password if the dialog was confirmed, otherwise Optional.empty()
.HeadlessException
- if GraphicsEnvironment.isHeadless
returns true
GraphicsEnvironment.isHeadless()
public static Optional<char[]> showPasswordDialog(@Nullable @Nullable Component parentComponent, Object message, String title, int messageType)
parentComponent
with the dialog having the title title
and message type messageType
.parentComponent
- the parent Component
for the dialogmessage
- the Object
to displaytitle
- the String
to display in the dialog
title barmessageType
- the type of message that is to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
Optional
holding the password if the dialog was confirmed, otherwise Optional.empty()
.HeadlessException
- if GraphicsEnvironment.isHeadless
returns true
GraphicsEnvironment.isHeadless()
public static Optional<String> showInputDialog(Object message)
message
- the Object
to displayOptional
holding the input if the dialog was confirmed, otherwise Optional.empty()
.HeadlessException
- if GraphicsEnvironment.isHeadless
returns true
GraphicsEnvironment.isHeadless()
public static Optional<String> showInputDialog(Object message, Object initialSelectionValue)
initialSelectionValue
.
The dialog uses the default frame, which usually means it is centered on the screen.message
- the Object
to displayinitialSelectionValue
- the value used to initialize the input fieldOptional
holding the input if the dialog was confirmed, otherwise Optional.empty()
.GraphicsEnvironment.isHeadless()
public static Optional<String> showInputDialog(@Nullable @Nullable Component parentComponent, Object message)
parentComponent
.
The dialog is displayed on top of the Component
's frame, and is usually positioned below the Component
.parentComponent
- the parent Component
for the dialogmessage
- the Object
to displayOptional
holding the input if the dialog was confirmed, otherwise Optional.empty()
.HeadlessException
- if GraphicsEnvironment.isHeadless
returns true
GraphicsEnvironment.isHeadless()
public static Optional<String> showInputDialog(@Nullable @Nullable Component parentComponent, Object message, Object initialSelectionValue)
parentComponent
.
The input value will be initialized to initialSelectionValue
.
The dialog is displayed on top of the Component
's frame, and is usually positioned below the Component
.parentComponent
- the parent Component
for the dialogmessage
- the Object
to displayinitialSelectionValue
- the value used to initialize the input fieldOptional
holding the input if the dialog was confirmed, otherwise Optional.empty()
.GraphicsEnvironment.isHeadless()
public static Optional<String> showInputDialog(@Nullable @Nullable Component parentComponent, Object message, String title, int messageType)
parentComponent
with the dialog having the title title
and message type messageType
.parentComponent
- the parent Component
for the dialogmessage
- the Object
to displaytitle
- the String
to display in the dialog title barmessageType
- the type of message that is to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
Optional
holding the input if the dialog was confirmed, otherwise Optional.empty()
.HeadlessException
- if GraphicsEnvironment.isHeadless
returns true
GraphicsEnvironment.isHeadless()
public static <T> Optional<T> showInputDialog(@Nullable @Nullable Component parentComponent, Object message, String title, int messageType, Icon icon, T[] selectionValues, T initialSelectionValue)
selectionValues
, where null
implies the user can input whatever they wish, usually by means of a JTextField
.
initialSelectionValue
is the initial value to prompt the user with.
It is up to the UI to decide how best to represent the selectionValues
, but usually a JComboBox
, JList
, or JTextField
will be used.T
- Type of input.parentComponent
- the parent Component
for the dialogmessage
- the Object
to displaytitle
- the String
to display in the dialog title barmessageType
- the type of message to be displayed:
ERROR_MESSAGE
,
INFORMATION_MESSAGE
,
WARNING_MESSAGE
,
QUESTION_MESSAGE
,
or PLAIN_MESSAGE
icon
- the Icon
image to displayselectionValues
- an array of Object
s that gives the possible selectionsinitialSelectionValue
- the value used to initialize the input fieldOptional
holding the input if the dialog was confirmed, otherwise Optional.empty()
.HeadlessException
- if GraphicsEnvironment.isHeadless
returns true
GraphicsEnvironment.isHeadless()
Copyright © 2016 Nelkinda Software Craft Pvt Ltd. All rights reserved.