Issue
I am using several horizontally positioned JSlider objects in my Java application and would like to align their left and right track ends vertically. That means whenever two knobs are positioned on the left end of their track the upper knob should be exactly above the lower one without any displacement in horizontal direction.
The problem I currently have is that long labels at ticks on the left or right end of a track decrease the length of the track and do not allow a nice alignment. As an example, see the following image:
JSlider alignment problem example
Does anyone know how to vertically align the tracks of two horizontally positioned JSlider objects independent of their tick labels?
A solution for my problem might be to left-align/right-align labels at the end of the track (i.e. the label on the far left tick is left-aligned to its tick), but I did not find out how I could do that. Maybe there is also a better solution I did not think about.
Thanks, Sandreal
Solution
I do not think that the JSlider labels are accessible in such a way that you can edit their location, so instead you should create separate labels and position then yourself relative to the JSlider, then you can be sure that they will not effect the JSlider (depending on your layout manager).
Answered By - sorifiend Answer Checked By - Candace Johnson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.