With the extension of my application, I would like to create additional classes for processing sql queries, validating data, etc. The controller currently controls all of this.
However, I have no idea how to create different classes that can "talk" to the components of my controller class and my .fxml file.
I confirmed this: XMLFML 1 FXML file with several different controllers?
.. and tried to create a new class to populate the table as follows:
import java.sql.Connection; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; public class DepartmentTable { private Connection conn; private FXMLLoader fxmlLoader; @FXML private TableView<Department> departmentTableView;
However, I get an invocationTargetException caused by a NullPointerException in
departmentIdCol.setCellValueFactory(
Therefore, I am not sure what to do at this moment.
Please, help. Thanks!
source share