How to hide the knob of jSlider?

后端 未结 3 1193
后悔当初
后悔当初 2021-01-22 17:01

I need to customize the knob of JSlider. I need to put my own knob\'s image over default knob of Jslider. The problem is that currently two knobs are coming in response. One my

3条回答
  •  余生分开走
    2021-01-22 17:34

    A solution with a different BasicSliderUI looks like this:

    public class SuperSlider extends JSlider {
        public SuperSlider(int min, int max, int value) {
            super(min,max,value);
            setUI(new SuperSliderUI(this));
        }
        private class SuperSliderUI extends BasicSliderUI {
            @Override
            public void paintThumb(Graphics g) {
            }
        }
    }

提交回复
热议问题