Reputation: 463
According to this Link javaFX 8u45 spinner, can be styled in numerous ways via style class. I do know how to do it by code.
For example:
spinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL);
or,
spinner.getStyleClass().add("split-arrows-horizontal");
However, not by fxml. I did try this, but it did not work. I did this via scenebuilder, version 8.
<Spinner fx:id="spn" editable="true" styleClass="split-arrows-horizontal"/>
Upvotes: 3
Views: 1692
Reputation: 49215
I am not sure why but defining styleClass
in FXML like
<Spinner fx:id="spn" styleClass="split-arrows-horizontal"/>
will not result adding that style to styleClass list. You can check it by
@FXML private Spinner spn;
@Override
public void initialize( URL url, ResourceBundle rb )
{
System.out.println( "getStyleClass: " + spn.getStyleClass() );
}
However, defining it in FXML as
<Spinner fx:id="spn">
<styleClass>
<String fx:value="split-arrows-horizontal" />
</styleClass>
</Spinner>
works as expected.
Upvotes: 1