I am trying to make a JSpinner with a set of values which step less and less as they decrease, so I created a function to generate these values and I add 100 values to a list, then try to create a SpinnerListModel with the list as it's source. This gives the following error:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: invalid sequence element
at javax.swing.SpinnerListModel.setValue(SpinnerListModel.java:185)
at com.fractalexplorer.main.RangeSelector.setValue(RangeSelector.java:106)
Here is the relevant code:
SpinnerListModel spinnerModel = new SpinnerListModel(constructSpinnerModelSource());
public List<Double> constructSpinnerModelSource()
{
List<Double> list = new ArrayList<Double>();
int steps = 100;
for(int i = 0; i <= steps; i++)
list.add(getStep(i));
return list;
}
public Double getStep(double x)
{
return 2.25 * Math.pow(0.95, x);
}
The values range from 2 to 0.013321190745751494 currently, here are the last 12 values:
0.02341981115445541, 0.022248820596732638, 0.021136379566896003,
0.020079560588551204, 0.01907558255912364, 0.018121803431167458,
0.017215713259609085, 0.01635492759662863, 0.015537181216797197,
0.014760322155957337, 0.01402230604815947, 0.013321190745751494