Open averbraeck opened 2 hours ago
An example what a constructor could look like is:
Integer, where the second value 100
indicates the number of ticks on the scale:
new MultiSlider<Integer>(SwingConstants.HORIZONTAL, 0, 100, 100, new int[] {25, 50, 75});
Double, where the value 200
indicates the number of ticks on the scale:
new MultiSlider<Double>(SwingConstants.HORIZONTAL, 0.0, 100.0, 200,
new double[] {25.0, 50.0, 75.0});
Map<Integer, String>
where the integers are the ticks and the strings the values:
var sliderMap = new HashMap<Integer, String>();
sliderMap.add(1, "A");
sliderMap.add(2, "B");
sliderMap.add(3, "C");
sliderMap.add(4, "D");
sliderMap.add(5, "E");
sliderMap.add(6, "F");
new MultiSlider<String>(SwingConstants.HORIZONTAL, sliderMap, new String[] {"A", "D");
Currently,
MultiSlider
accepts only int values, but it is often used in situations where other scales might be needed, such as a categorial scale, a floating point scale, or a scale using a djunits quantity. In a sense, we want aMultiSlider<T>
whereT
indicates the type that can be set on the ticks of theMultiSlider
.This can either be an extension of the current
MultiSlider
class, or theMultiSlider
can be made generic itself.