code: private static void disableSpinnerDragging(JSpinner spinner)
      {
          int n = spinner.getComponentCount();
          for (int i=0; i<n; i++)
          {
              Component c = spinner.getComponent(i);
              String name = c.getName();
              if ("Spinner.nextButton".equals(name) ||
                  "Spinner.previousButton".equals(name))
              {
                  MouseMotionListener mouseMotionListeners[] =
                      c.getMouseMotionListeners();
                  for (MouseMotionListener m : mouseMotionListeners)
                  {
                      if (m instanceof SpinnerDraggingHandler)
                      {
                          c.removeMouseMotionListener(m);
                      }
                  }
                  MouseListener mouseListeners[] =
                      c.getMouseListeners();
                  for (MouseListener m : mouseListeners)
                  {
                      if (m instanceof SpinnerDraggingHandler)
                      {
                          c.removeMouseListener(m);
                      }
                  }
              }
          }
      }
docs: Disable dragging for the given spinner, by removing all
  mouse motion listeners that are {@link SpinnerDraggingHandler}s
  from the spinner buttons
  
  @param spinner The spinner