Java JComboBox Value getDouble(javax.swing.JComboBox input)

Here you can find the source of getDouble(javax.swing.JComboBox input)

Description

Get double from the JComboBox input

License

Open Source License

Parameter

Parameter Description
input the JComboBox object

Return

the double number

Declaration

public static double getDouble(javax.swing.JComboBox input) throws Exception 

Method Source Code

//package com.java2s;
/*/*  www.  j av a  2  s.  co  m*/
 * @(#)VerifyUtil.java   
 *
 * Copyright (C) 2006 www.interpss.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * @Author Mike Zhou
 * @Version 1.0
 * @Date 09/15/2006
 * 
 *   Revision History
 *   ================
 *
 */

public class Main {
    /**
     * Get double from the JTextField input
     * 
     * @param input the JTextField object
     * @return the double number
     */
    public static double getDouble(javax.swing.JTextField input) throws Exception {
        return new Double(input.getText()).doubleValue();
    }

    /**
     * Get double from the input
     * 
     * @param input the object, has to be instanceOf Double
     * @return the double number
     */
    public static double getDouble(Object input) {
        return ((Double) (input)).doubleValue();
    }

    /**
     * Get double from the JComboBox input
     * 
     * @param input the JComboBox object
     * @return the double number
     */
    public static double getDouble(javax.swing.JComboBox input) throws Exception {
        return new Double((String) (input.getSelectedItem())).doubleValue();
    }
}

Related

  1. createComboBox(ActionListener actionListener, Vector values, String command)
  2. createComboBox(final Preferences node, final String pref_name, final String[] options, final String default_value)
  3. createStandardCombo(String[] values)
  4. fillValue(Vector vtData, int iComboIndex, int iVectorIndex, JComboBox cbo, Vector vt, boolean bClear, boolean bHaveNull)
  5. getCmbValue(JComboBox cmb)
  6. getIfHasValue(Object val, JComboBox cb)
  7. getInt(JComboBox combo)
  8. IsComboBoxModified(JComboBox comboBox, Object originalValue)
  9. replaceContents(JComboBox combob, Object[] values)