public class SwingMessageOutput extends Object implements MessageOutput
A Swing specific implementation of the MessageOutput
interface.
This implementation makes use of JOptionPane for displaying
message boxes.
BTN_OK, BTN_OK_CANCEL, BTN_YES_NO, BTN_YES_NO_CANCEL, MESSAGE_ERROR, MESSAGE_INFO, MESSAGE_PLAIN, MESSAGE_QUESTION, MESSAGE_WARNING, RET_CANCEL, RET_NO, RET_OK, RET_YES| Constructor and Description |
|---|
SwingMessageOutput() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
convertButtonType(int type)
Converts the passed in button type into the corresponding option type
used by
JOptionPane. |
protected int |
convertMessageType(int type)
Converts the passed in message type into the corresponding type used by
JOptionPane. |
protected int |
convertReturnValue(int value)
Converts the passed in return value from the
JOptionPane
to the corresponding RET_XXXX constant. |
protected JDialog |
createDialog(JOptionPane pane,
Window parent,
String title)
Creates the dialog from the option pane.
|
protected JOptionPane |
createOptionPane(Window parent,
Object message,
String title,
int messageType,
int optionType)
Creates the option pane dialog for displaying the message box.
|
int |
show(Window parent,
Object message,
String title,
int messageType,
int buttonType)
Displays a message box.
|
protected Object |
showPane(JOptionPane pane,
JDialog dialog)
Displays the given option pane.
|
public int show(Window parent, Object message, String title, int messageType, int buttonType)
show in interface MessageOutputparent - the parent window; this should be null or point to
a Swing windowmessage - the messagetitle - the message box's titlemessageType - the type of the messagebuttonType - specifies the buttons to be displayedprotected int convertMessageType(int type)
JOptionPane.type - the type to be convertedprotected int convertButtonType(int type)
JOptionPane.type - the type to be convertedprotected int convertReturnValue(int value)
JOptionPane
to the corresponding RET_XXXX constant.value - the return value from the option paneRET_XXXX constantprotected JOptionPane createOptionPane(Window parent, Object message, String title, int messageType, int optionType)
parent - the parent windowmessage - the messagetitle - the titlemessageType - the message typeoptionType - the option typeprotected Object showPane(JOptionPane pane, JDialog dialog)
pane - the pane to displaydialog - the dialog obtained from the option paneprotected JDialog createDialog(JOptionPane pane, Window parent, String title)
pane - the option paneparent - the parent componenttitle - the dialog's titleCopyright © 2013 The JGUIraffe Team. All Rights Reserved.