Here you can find the source of getSpinnerFloatValue(JSpinner sp)
Parameter | Description |
---|---|
sp | a parameter |
public static float getSpinnerFloatValue(JSpinner sp)
//package com.java2s; // LICENSE: This file is distributed under the BSD license. import javax.swing.JSpinner; public class Main { /**//from www . j ava2 s . com * Utility function to access the spinner value. * @param sp * @return */ public static float getSpinnerFloatValue(JSpinner sp) { // TODO figure out why the type of value in the numbermodel is // changing type to float which necessitates this code float f; try { f = (float) ((Double) sp.getValue()).doubleValue(); } catch (Exception ex) { f = ((Float) sp.getValue()).floatValue(); } return f; } }