public class Slider extends JSlider
{
/*
+ * the number of nominal positions the slider represents
+ * (higher number = more fine-grained positioning)
+ */
+ private static final int SCALE_TICKS = 1000;
+
+ /*
* 'true' value corresponding to zero on the slider
*/
private float trueMin;
trueMin = min;
trueMax = max;
setMinimum(0);
- sliderScaleFactor = 100f / (max - min);
+ sliderScaleFactor = SCALE_TICKS / (max - min);
int sliderMax = (int) ((max - min) * sliderScaleFactor);
setMaximum(sliderMax);
setSliderValue(value);
}
/**
- * Answers the value of the slider position as a percentage between minimum and
- * maximum of its range
+ * Answers the value of the slider position as a percentage between minimum
+ * and maximum of its range
*
* @return
*/