h1. Introduction
The application I am developing loads an FXML file from a Controller. The FXML uses CSS and images for buttons are set in the CSS.
CSS directory structure
<package>.fxml
Images
<package>.fxml.resources.<subdir>
Example CSS Code
.buttonImage {
-fx-background-image: url("resources/subdir/image.png");
}
Example loading fxml from controller code
URL location = getClass().getResource("/package/fxml/UI.fxml");
FXMLLoader fxmlLoader = new FXMLLoader(location);
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = (Parent)fxmlLoader.load(location.openStream());
Controller = (Controller) fxmlLoader.getController();
newPane.getChildren().add(root);
h1. Problem
The fxml file does not load and causes the following error:
javafx.fxml.LoadException: Page language not specified.
Note, the fxml file loaded correctly before images were added.
Any ideas of what might be going wrong?
h1. Attempted
I have attempted the following: tried changing the url of the image as an absolute path.