1//making a red button in javafx
2
3Button button = new Button("My Button");
4button.setStyle("-fx-background-color: #ff0000; ");
5
1BackgroundImage backgroundImage = new BackgroundImage( new Image( getClass().getResource("/testing/background.jpg").toExternalForm()), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
2 Background background = new Background(backgroundImage);
3
4 Button button = new Button( "Click me!");
5 button.setBackground(background);
1/*can address these properties: */
2-fx-border-width
3-fx-border-color
4-fx-background-color
5-fx-font-size
6-fx-text-fill
7
8/* see source for more examples
9 see JavaFX CSS Reference Guide for additional properties:
10 https://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html
11*/