Tuesday, December 19, 2017

JAVAFX - How add support for CSS to your application

Three main ways:

1) For every Scene instance you can add support for css:
Scene scene = new Scene( root );
scene.getStylesheets().add( getClass().getResource( "style.css" ).toExternalForm() );

2) For every control item you can call setStyle() method:
button.setStyle( "-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );");



3) In .fxml editor (scene builder) in menu Preview:

No comments:

Post a Comment