2 Replies Latest reply: Jan 27, 2012 2:30 AM by 870239 RSS

    How to make a round Slider with an image ?

      hello everybody,

      I'm back and i have a new question : how to make a round Slider (like a volume knob) with an image ?
      I see this very interisting tutorial : http://fxexperience.com/2012/01/fun-javafx-2-0-audio-player/ but it use a private class from com.sun.javafx.scene.control.skin.SkinBase...

      thank you for your answer.
        • 1. Re: How to make a round Slider with an image ?
          I'm guessing you could subclass Slider to create a class SliderKnob.

          At some stage in the process, not sure where (perhaps after calling super in the constructor), you could look up the slider region's child thumbnail and track and call setVisible(false) and setManaged(false) on them, create an ImageView for your knob, add the knob ImageView to the slider's region and bind the ImageView's rotateProperty to the slider's valueProperty(). Not sure that that is any better than using the SkinBase stuff, but at least it is an alternative idea.

          Everything to create your own controls has not been added to the public API, so if you want to make your own controls in the same way the JavaFX does them (i.e. with Skin's and Behaviours and stuff like that) you have to make use of com.sun classes unless you can subclass and modify the workings of existing controls similar to what is proposed in the preceding paragraph.
          • 2. Re: How to make a round Slider with an image ?

            I would consider to look this http://fxexperience.com/2012/01/fun-javafx-2-0-audio-player/ there's source available!

            Volume knob is created a top of slider component.

            - kapseli