Language: JavaFX
IDE: Netbeans
Problem: I\'m trying to add a css file to the stylesheet, but the first line of the following code always generates a Nu
I made a small login example and this is how i link my styleshet.css
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("LoginUI.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(JavaFXLogin.class.getResource("stylesheet.css").toExternalForm());
stage.setScene(scene);
stage.show();
}
You can use this code line to link your css file. but the css file should be in your package.
scene.getStylesheets().add(JavaFXLogin.class.getResource("stylesheet.css").toExternalForm());