Here you can find the source of getInt(JSpinner spinner)
public static int getInt(JSpinner spinner)
//package com.java2s; //License from project: Open Source License import javax.swing.JComboBox; import javax.swing.JSpinner; public class Main { public static int getInt(JComboBox combo) { int rv = 0; Object o = combo.getSelectedItem(); if (o != null) { if (o instanceof Number) { rv = ((Number) o).intValue(); } else { String s = o.toString(); if (s != null) { try { rv = Integer.parseInt(s.trim()); } catch (NumberFormatException ex) { }/*from w w w.j a v a 2 s .com*/ } } } return rv; } public static int getInt(JSpinner spinner) { int rv = 0; Object o = spinner.getValue(); if (o != null) { if (o instanceof Number) { rv = ((Number) o).intValue(); } } return rv; } }