Here you can find the source of chooseObject(String message, String messageTitle, Object[] objects, Object initialObject)
Parameter | Description |
---|---|
message | a parameter |
messageTitle | a parameter |
objects | a parameter |
initialObject | a parameter |
Parameter | Description |
---|---|
Exception | an exception |
public static Object chooseObject(String message, String messageTitle, Object[] objects, Object initialObject) throws Exception
//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; } }