Check out example codes for "cgange background from button click java fx". It will help you in understanding the concepts better.

Code Example 1

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);

Learn ReactJs, React Native from akashmittal.com