I am getting an error in Netbeans While applying CSS style-sheet to JavaFX application through Scene Builder.
Error message in Netbeans is:
null/FXMLDocument.css Sep 17, 2014 12:44:43 AM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
WARNING: Resource "FXMLDocument.css" not found.
All I did is to add the css file located in the same source folder as the FXMLDocument.fxml file is.

Beginning of FXML looks like this:
<AnchorPane id="AnchorPane" fx:id="mainWindowPane" focusTraversable="true" stylesheets="@FXMLDocument.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="a.b.c.d.ui.FXMLDocumentController">
Any idea why is this happening, what exactly am I missing here and any suggestions to resolve this.
Update:
This is the start method:
@Override
public void start(Stage stage) throws Exception {
try {
setUserAgentStylesheet(STYLESHEET_MODENA);
FXMLLoader loader = new FXMLLoader();
Parent root = (Parent) loader.load(getClass().getResourceAsStream("ui/ParentWindow.fxml"));
final ParentWindowController controller = (ParentWindowController) loader.getController();
stage.addEventHandler(WindowEvent.WINDOW_SHOWN, controller::handleWindowShownEvent);
stage.addEventHandler(WindowEvent.WINDOW_SHOWING, controller::handleWindowShowingEvent);
stage.addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, controller::handleWindowClosingRequestedEvent);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setResizable(false);
stage.toFront();
stage.setTitle("Sample Code");
stage.getIcons().add(new Image(getClass().getResourceAsStream("resources/images/Logo.jpg")));
stage.show();
} catch (IOException iOException) {
iOException.printStackTrace();
}
}
Is this because of the FXMLLoader loader = new FXMLLoader(); object that JavaFX is not able to resolve the absolute path to css in FXML and then null/FXMLDocument.css
Adding below lines in start method works fine though.
scene.getStylesheets().setAll(
getClass().getResource("ui/FXMLDocument.css").toExternalForm()
);