I am new to Java and JavaFX. I am trying to develop an CRUD application for employee data. I am adding the FXML file into a tab. The code is as follows.
tabEmployee.setContent((Node) FXMLLoader.load(getClass().getResource("EmployeeOverview.fxml")));
This works fine but when I try to do the same as follows
private URL URLEmployeeOverview = getClass().getResource("EmployeeOverview.fxml");
FXMLLoader loaderEmployeeOverview = new FXMLLoader(URLEmployeeOverview);
tabEmployee.setContent((Node) loaderEmployeeOverview);
I am getting an error:
incompatible types. FXMLLoader cannot be converted to Node
May I get help on why this happens and how to correct it.
You should invoke the load method: