开发者

How can I offset the pointer on a JSilder?

In Java how can I offset the knob from my JSilder track?

                \/
|----------------开发者_Go百科--------------|

I want it above the track, not on it.


You would need to create a custom SliderUI.

You would probably extend MetalSliderUI. The paintThumb() method is responsible for painting the thumb so you probably need to customize that method to change the Y offset of the thumb. You would then also need to change the preferred size calculation to account for this offset as well.


If you mean, how can you set the current value of the JSlider, you should read the API and see that you can use setValue. The question sounds confusing because you use the terms pointer and offset, which typically carry a completely different meaning in programming.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜