how to add JAVAfx button code example
Example 1: Javafx button color
//making a red button in javafx
Button button = new Button("My Button");
button.setStyle("-fx-background-color: #ff0000; ");
Example 2: cgange background from button click java fx
BackgroundImage backgroundImage = new BackgroundImage( new Image( getClass().getResource("/testing/background.jpg").toExternalForm()), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
Background background = new Background(backgroundImage);
Button button = new Button( "Click me!");
button.setBackground(background);
Example 3: javafx change button background color
-fx-border-width
-fx-border-color
-fx-background-color
-fx-font-size
-fx-text-fill