Java JOptionPane Message msgChoice(int options, String title, String msg, String item, String sep)

Here you can find the source of msgChoice(int options, String title, String msg, String item, String sep)

Description

Show a message with options to choose from

Wrapper for JOptionPane with I18N support

License

Open Source License

Parameter

Parameter Description
options the options to be shown in the dialog
title the title to be shown in the dialog
msg the message to be shown in the dialog
item a variable part to be shown before msg
sep a separator for msg and item (return or blank etc.)

Return

the choice

Declaration

public static int msgChoice(int options, String title, String msg, String item, String sep) 

Method Source Code

//package com.java2s;
/*/*from   www .ja  v a 2  s  .c o  m*/
 * This file is part of the Scriba source distribution. This is free, open-source 
 * software. For full licensing information, please see the LicensingInformation file
 * at the root level of the distribution.
 *
 * Copyright (c) 2006-2007 Kobrix Software, Inc.
 */

import javax.swing.JOptionPane;

public class Main {
    /**
     * Show a message with options to choose from
     * 
     * <p>
     * Wrapper for JOptionPane with I18N support
     * </p>
     * 
     * @param options the options to be shown in the dialog
     * @param title the title to be shown in the dialog
     * @param msg the message to be shown in the dialog
     * @param item a variable part to be shown before msg
     * @param sep a separator for msg and item (return or blank etc.)
     * 
     * @return the choice
     */
    public static int msgChoice(int options, String title, String msg, String item, String sep) {
        String message = item + sep + msg;
        return JOptionPane.showConfirmDialog(null, message, title, options, JOptionPane.QUESTION_MESSAGE);
    }
}

Related

  1. msg(String msg)
  2. msg(String s)
  3. msgbox(Object message)
  4. msgBox(String msg)
  5. msgBox(String title, String message)
  6. notImplemented(final String message)
  7. noTo(String message)
  8. optionWindow(String message, String title, String[] options)
  9. pause(final String msg)