My JSlider first value is 0 and the last value is 8850. I want to set the major tick spacing so that the last value (8850) to be printed. For example if I set the major tick spacing to 550 the last value printed will be 8800.
My JSlider first value is 0 and the last value is 8850 . I
Share
You can use the
JSlider#setLabelTablemethod to control which labels are painted. TheJSlider#createStandardLabelsavoids that you have to manually create all labels. It is sufficient to use that method to generate them for you, and just add your label for the max value to it.The Swing slider tutorial even has sample code how to use custom labels