Java JOptionPane Message chooseObject(String message, String messageTitle, Object[] objects, Object initialObject)

Here you can find the source of chooseObject(String message, String messageTitle, Object[] objects, Object initialObject)

Description

Asks the User to select an Object from a given array of Objects.

License

Open Source License

Parameter

Parameter Description
message a parameter
messageTitle a parameter
objects a parameter
initialObject a parameter

Exception

Parameter Description
Exception an exception

Declaration

public static Object chooseObject(String message, String messageTitle, Object[] objects, Object initialObject)
        throws Exception 

Method Source Code


//package com.java2s;
import javax.swing.JOptionPane;

public class Main {
    /**/*from  w  w w . j  av a 2 s . c o m*/
     * Asks the User to select an Object from a given array of Objects.
     * @param message
     * @param messageTitle
     * @param objects
     * @param initialObject
     * @return
     * @throws Exception
     */
    public static Object chooseObject(String message, String messageTitle, Object[] objects, Object initialObject)
            throws Exception {
        Object input = JOptionPane.showInputDialog(null, message, messageTitle, JOptionPane.INFORMATION_MESSAGE,
                null, objects, initialObject);
        if (input == null)
            throw new Exception("Selection aborted");
        return input;
    }
}

Related

  1. alert(Component component, String title, String msg)
  2. askPassword(String message)
  3. browse(String url, Component msgParent)
  4. browse(String url, Component msgParent)
  5. chooseIndex(String message, String messageTitle, Object[] objects, Object initialObject)
  6. copyToClipBoard(String code, boolean displayMessage)
  7. createPane(Component comp, String msg)
  8. createPane(int type, String message, int messageMaxLength)
  9. debug(String message)