I write a JavaFX application and I'd like to skin it with css.
I've successfully added a style sheet to my application like this:
//Java code
FXMLLoader loader = new FXMLLoader(MainApp.class.getResource("/path/to/fxml"));
Scene scene = new Scene(loader.load());
scene.getStylesheets().add(getClass().getResource("/path/to/css").toExternalForm());
I need to change text color, but there is no style class for text object by default.
I created FXML files with SceneBuilder. To assign a text object to a class, I typed the class name to the proper text field (Sidebar >> JavaFX CSS >> Style Class).
CSS file:
.myText {
-fx-text-fill: #ffffff;
}
However if I run my app, this method does change nothing. How can I solve this problem?