I\'m trying to load a CSS file into JavaFX using this line of code and it gives me a null pointer exception:
scene.getStylesheets().add(welcome.class.getReso
Did you initialize the Scene object yet?
//Create a scene object. Pass in the layout and set with and height
this.scene = new Scene(layout, 600, 400);
//Add CSS Style Sheet (located in same package as this class).
String css = this.getClass().getResource("background.css").toExternalForm();
scene.getStylesheets().add(css);