JOptionPane (Java Platform SE 7 )

Methods

 

Modifier and Type
Method and Description

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.

JInternalFrame
createInternalFrame(Component parentComponent,
String title)

Creates and returns an instance of JInternalFrame.

AccessibleContext
getAccessibleContext()

Returns the AccessibleContext associated with this JOptionPane.

static JDesktopPane
getDesktopPaneForComponent(Component parentComponent)

Returns the specified component’s desktop pane.

static Frame
getFrameForComponent(Component parentComponent)

Returns the specified component’s Frame.

Icon
getIcon()

Returns the icon this pane displays.

Object
getInitialSelectionValue()

Returns the input value that is displayed as initially selected to the user.

Object
getInitialValue()

Returns the initial value.

Object
getInputValue()

Returns the value the user has input, if wantsInput
is true.

int
getMaxCharactersPerLineCount()

Returns the maximum number of characters to place on a line in a
message.

Object
getMessage()

Returns the message-object this pane displays.

int
getMessageType()

Returns the message type.

Object[]
getOptions()

Returns the choices the user can make.

int
getOptionType()

Returns the type of options that are displayed.

static Frame
getRootFrame()

Returns the Frame to use for the class methods in
which a frame is not provided.

Object[]
getSelectionValues()

Returns the input selection values.

OptionPaneUI
getUI()

Returns the UI object which implements the L&F for this component.

String
getUIClassID()

Returns the name of the UI class that implements the
L&F for this component.

Object
getValue()

Returns the value the user has selected.

boolean
getWantsInput()

Returns the value of the wantsInput property.

protected String
paramString()

Returns a string representation of this JOptionPane.

void
selectInitialValue()

Requests that the initial value be selected, which will set
focus to the initial value.

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.

static void
setRootFrame(Frame newRootFrame)

Sets the frame to use for class methods in which a frame is
not provided.

void
setSelectionValues(Object[] newValues)

Sets the input selection values for a pane that provides the user
with a list of items to choose from.

void
setUI(OptionPaneUI ui)

Sets the UI object which implements the L&F for this component.

void
setValue(Object newValue)

Sets the value the user has chosen.

void
setWantsInput(boolean newValue)

Sets the wantsInput property.

static int
showConfirmDialog(Component parentComponent,
Object message)

Brings up a dialog with the options Yes,
No and Cancel; with the
title, Select an Option.

static 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.

static 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.

static 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.

static String
showInputDialog(Component parentComponent,
Object message)

Shows a question-message dialog requesting input from the user
parented to parentComponent.

static String
showInputDialog(Component parentComponent,
Object message,
Object initialSelectionValue)

Shows a question-message dialog requesting input from the user and
parented to parentComponent.

static 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.

static 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.

static String
showInputDialog(Object message)

Shows a question-message dialog requesting input from the user.

static String
showInputDialog(Object message,
Object initialSelectionValue)

Shows a question-message dialog requesting input from the user, with
the input value initialized to initialSelectionValue.

static 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.

static 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.

static 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.

static int
showInternalConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType,
int messageType,
Icon icon)

Brings up an internal dialog panel with a specified icon, where
the number of choices is determined by the optionType
parameter.

static String
showInternalInputDialog(Component parentComponent,
Object message)

Shows an internal question-message dialog requesting input from
the user parented to parentComponent.

static 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.

static 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.

static void
showInternalMessageDialog(Component parentComponent,
Object message)

Brings up an internal confirmation dialog panel.

static 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.

static void
showInternalMessageDialog(Component parentComponent,
Object message,
String title,
int messageType,
Icon icon)

Brings up an internal dialog panel displaying a message,
specifying all parameters.

static 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.

static void
showMessageDialog(Component parentComponent,
Object message)

Brings up an information-message dialog titled “Message”.

static 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.

static void
showMessageDialog(Component parentComponent,
Object message,
String title,
int messageType,
Icon icon)

Brings up a dialog displaying a message, specifying all parameters.

static 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.

void
updateUI()

Notification from the UIManager that the L&F has changed.