Here you can find the source of setList(JSpinner spinner, List> values)
Parameter | Description |
---|---|
spinner | the spinner to update |
values | the model list values |
public static void setList(JSpinner spinner, List<?> values)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.List; import javax.swing.JSpinner; import javax.swing.SpinnerListModel; import javax.swing.SpinnerModel; public class Main { /**// ww w .j a v a 2 s . c o m * Assign the List model (for a list-based spinner) * * @param spinner the spinner to update * @param values the model list values */ public static void setList(JSpinner spinner, List<?> values) { SpinnerModel model = spinner.getModel(); if (model instanceof SpinnerListModel) { ((SpinnerListModel) model).setList(values); } else { throw new IllegalArgumentException("Spinner model is not a SpinnerListModel"); } } }