init css file and bind with app

This commit is contained in:
giavaphi
2022-11-25 02:29:07 +01:00
parent 1c83fc4694
commit e22cb0b24d
3 changed files with 12 additions and 2 deletions
@@ -73,7 +73,10 @@ public class AppLoader {
public Object loadSceneToStage(String fxmlFile, Stage appendee) throws IOException {
FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(HelloApplication.class.getResource(fxmlFile)));
Pane root = loader.load();
appendee.setScene(new Scene(root));
Scene scene = new Scene(root);
String css = Objects.requireNonNull(this.getClass().getResource("styles.css")).toExternalForm();
appendee.setScene(scene);
scene.getStylesheets().add(css);
Object controller = loader.getController();
annotationInject(controller);
return controller;