Here you can find the source of readDoubleFromField(JTextField inField, double defaultValue)
public static double readDoubleFromField(JTextField inField, double defaultValue)
//package com.java2s; //License from project: Open Source License import javax.swing.JTextField; public class Main { public static double readDoubleFromField(JTextField inField, double defaultValue) { try {//from w w w. j a va2 s . c o m return Double.valueOf(inField.getText()); } catch (Exception e) { return defaultValue; } } }