I want to add a few custom widgets to an application. For example: I’d like a dual slider that has a piano keyboard as part of the display, for setting a note range. To that end, I’ve forked and am studying the source code of the JFoenix “material” widgets. Since I want to build custom sliders, I thought I’d try look at the code being used for their
This thread is to ask (and answer) questions as they come up. There is a LOT of background knowledge needed to understand what is going on here!
First question: there is a class for the widget (
JFXSlider) and another for the skin for the widget (
JFXSliderSkin). In the latter, object members are associated with .css values. I’m noticing that there are three different ways this is done:
// 1) StackPane track = (StackPane) getSkinnable().lookup(".track"); // 2) StackPane coloredTrack = new StackPane(); coloredTrack.getStyleClass().add("colored-track"); // 3) Text sliderValue = new Text(); sliderValue.getStyleClass().setAll("slider-value");
In each case, the items in quotes are present in the file
Any thoughts on why any one of these methods might be preferred over the other?
I’m continuing tomorrow with looking into the API specifics of each method (lookup/add/setAll). Maybe I’ll be able to find an answer. But just coming across this code for the first time, the answer isn’t obvious to me.