Java Utililty Methods JOptionPane Message

List of utility methods to do JOptionPane Message

Description

The list of methods to do JOptionPane Message are organized into topic(s).

Method

voidshowMessage(String msg)
show Message
showMessage(new String[] { msg });
voidshowMessage(String title, String message)
Display a sample message in a dialog box.
JOptionPane.showMessageDialog(null, message, title, JOptionPane.INFORMATION_MESSAGE);
voidshowMessage(String title, String message, java.awt.Component parent)
show Message
JOptionPane.showMessageDialog(parent, splitIntoLines(message), title, JOptionPane.INFORMATION_MESSAGE);
voidshowMessageInEventQueue(final String message, final String title)
show Message In Event Queue
EventQueue.invokeLater(new Runnable() {
    public void run() {
        showMessage(message, title);
});
voidshowMessages(Component parent, List messages)
show Messages
if ((messages == null) || (messages.size() == 0)) {
    return;
Window window = SwingUtilities.windowForComponent(parent);
StringBuilder sb = new StringBuilder();
if (messages != null) {
    for (int i = 0, size = messages.size(); i < size; i++) {
        sb.append(messages.get(i));
...
voidshowMsg(final Container parent, final String message)
show Msg
SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
        JOptionPane.showMessageDialog(parent, message, UIManager.getString("OptionPane.messageDialogTitle"),
                JOptionPane.INFORMATION_MESSAGE);
});
booleanShowOkCancelMessage(String msg)
Show Ok Cancel Message
int result = JOptionPane.showConfirmDialog(null, msg, "Confirmation dialog", JOptionPane.OK_CANCEL_OPTION);
if (result == JOptionPane.YES_OPTION)
    return true;
else
    return false;
voidShowOkMessage(String msg)
Show Ok Message
JOptionPane.showMessageDialog(null, msg);
intshowPrettyYesNoPane(Component caller, String msg, String title)
show Pretty Yes No Pane
Object[] options = { "Yes", "No" };
return JOptionPane.showOptionDialog(caller,
        "<html><body><p style='width: 200px;'>" + msg + "</p></body></html>", title,
        JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
intshowQuestionThreeChoicesBox(Component pParent, String pMessage, String pTitle, String pLeftOption, String pMiddleOption, String pRightOption)
Results: YES_OPTION = Middle NO_OPTION = Left CANCEL_OPTION = Right
UIManager.put("OptionPane.noButtonText", pLeftOption);
UIManager.put("OptionPane.yesButtonText", pMiddleOption);
UIManager.put("OptionPane.cancelButtonText", pRightOption);
int result = JOptionPane.showConfirmDialog(pParent, pMessage, pTitle, JOptionPane.YES_NO_CANCEL_OPTION,
        JOptionPane.QUESTION_MESSAGE);
UIManager.put("OptionPane.noButtonText", "No");
UIManager.put("OptionPane.yesButtonText", "Yes");
UIManager.put("OptionPane.cancelButtonText", "Cancel");
...