import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;

public class FinalExample extends Application {
    private final Color[] cs = {Color.RED, Color.BLUE, Color.GREEN, Color.ORANGE};
    private int i = 0;

    public void start(Stage stage) {
        stage.setTitle("Final Example");

        final Button btn = new Button("Click me to change Color!");
        btn.setFont(Font.font(null, FontWeight.BOLD, 14));
        btn.setOnAction(e -> {
            i = (i + 1) % cs.length;
            btn.setTextFill(cs[i]);
        });
        Group root = new Group();
        root.getChildren().addAll(btn);
        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String... args) {
        launch(args);
    }
}
