Java JOptionPane Message queryDouble(String message, double initialValue)

Here you can find the source of queryDouble(String message, double initialValue)

Description

Queries the User for a Double values using Swing.

License

Open Source License

Parameter

Parameter Description
message a parameter
initialValue a parameter

Exception

Parameter Description
Exception an exception

Return

the chosen double

Declaration

public static double queryDouble(String message, double initialValue) throws Exception 

Method Source Code

//package com.java2s;
/*//  w  w w . j  a v  a 2 s .  c o m
 * Copyright (C) 2010-2014  Andreas Maier
 * CONRAD is developed as an Open Source project under the GNU General Public License (GPL).
 */

import javax.swing.JOptionPane;

public class Main {
    /**
     * Queries the User for a Double values using Swing.
     * @param message
     * @param initialValue
     * @return the chosen double
     * @throws Exception
     */
    public static double queryDouble(String message, double initialValue) throws Exception {
        String input = JOptionPane.showInputDialog(message, "" + initialValue);
        if (input == null)
            throw new Exception("Selection aborted");
        return Double.parseDouble(input);
    }
}

Related

  1. popupMessage(String message)
  2. popupMessage(String title, String message)
  3. promptForFloat(Component parentComponent, String message, String title, float oldValue)
  4. promptForString(Component parentComponent, String message, String title, String oldValue)
  5. queryBoolean(String message)
  6. queryInt(String message, int initialValue)
  7. requestPassword(String titulo, String msg)
  8. select(String[] selList, String msg)
  9. show(String title, int type, Object message, Object[] options, Object initialOption)