Java JOptionPane Message optionWindow(String message, String title, String[] options)

Here you can find the source of optionWindow(String message, String title, String[] options)

Description

This method will display an option dialog box to get an index value of a given array of options

License

Open Source License

Parameter

Parameter Description
message message to be displayed
title title of window
options array of options

Return

index of option chosen

Declaration

public static int optionWindow(String message, String title, String[] options) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.swing.*;

public class Main {
    /**/*from   w w  w  .j  a v a2 s  . c  o  m*/
     * This method will display an option dialog box
     * to get an index value of a given array of
     * options
     *
     * @param message message to be displayed
     * @param title   title of window
     * @param options array of options
     * @return index of option chosen
     */
    public static int optionWindow(String message, String title, String[] options) {

        return JOptionPane.showOptionDialog(null, message, title, JOptionPane.DEFAULT_OPTION,
                JOptionPane.QUESTION_MESSAGE, null, options, 0);
    }
}

Related

  1. msgBox(String msg)
  2. msgBox(String title, String message)
  3. msgChoice(int options, String title, String msg, String item, String sep)
  4. notImplemented(final String message)
  5. noTo(String message)
  6. pause(final String msg)
  7. plain(String title, Object message, JComponent parent)
  8. popup(Component parent, String message, String title)
  9. popupMessage(String message)