JavaFX newbie here. I am using NetBeans 8.0 IDE and I placed my FXML file RootLayout.fxml in com.techie.java.view package. I am loading this fxml file using the following code declared in com.techie.java.controller package:
private void initRootLayout() {
try {
pane = FXMLLoader.load(ContactManager.class.getResource("/view/RootLayout.fxml"));
Scene scene = new Scene(pane);
stage.setScene(scene);
stage.show();
} catch (IOException ie) {
ie.printStackTrace();
}
}
private void showPersonOverview() {
try {
AnchorPane anchorPane = FXMLLoader.load(ContactManager.class.getResource("/view/PersonOverview.fxml"));
pane.setCenter(anchorPane);
} catch (IOException ie) {
ie.printStackTrace();
}
}
While executing I am getting Null pointer exception at BorderPane pane = FXMLLoader.load(ContactManager.class.getResource("/view/RootLayout.fxml"));.
What am I doing wrong?
getResource()return?