Looking to jazz up my JavaFX application with some custom CSS styling.
Managed to link a stylesheet to my app using the following code:
//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());
Trying to change the text color, but can't find a default style class for text objects here.
Designed FXML files through SceneBuilder. Assigned a text object to a class by entering the class name in the appropriate text field (Sidebar >> JavaFX CSS >> Style Class).
https://i.stack.imgur.com/0dIUw.png
CSS file snippet:
.myText {
-fx-text-fill: #ffffff;
}
However, applying this method doesn't seem to have any effect when running the app. Any suggestions on how to tackle this issue?