amertkara / seaglass

Automatically exported from code.google.com/p/seaglass
0 stars 0 forks source link

JSlider track and knob disagree when Jslider minimun is non-zero #111

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a Jslider with 3 arg constrcutor where none of the args = 0
2.
3.

What is the expected output? What do you see instead?
It is expected that the track will be painted as far as the knob location.
The track is painted beyond the knob location by a distance equal to the 
minimum value.

If the minimum value is 3 and the set value is 3 the track will be painted to 6 
but the knob will be at 3.

What version of the product are you using? On what operating system? What
JRE version?

seaglass 0.2
java 1.7
windows 7

Please provide any additional information below.

Original issue reported on code.google.com by bw800...@gmail.com on 11 Nov 2014 at 3:37

GoogleCodeExporter commented 9 years ago
I think the line in the paintValueTrack method of SliderTrackPainter class:
double percentFilled = slider.getValue() / trackLength; 
should be:
double percentFilled = (slider.getValue()-slider.getMinimum()) / trackLength; 

I haven't tested it, but I think it may solve the problem.

Original comment by bw800...@gmail.com on 11 Nov 2014 at 4:03