I have an ordersFXML which has a tableview (ordersTable). When you click a button that pops up another paymentsFXML (payments)which contains a payButton. After clicking payButton paymentsFXML closes. My problem is here. I want ordersTable to be cleared up, emptied as soon as payButton is clicked.
Is there any way to do it? Here is my code below.
OrdersFXMLController.java
@FXML
private TableView<Orders> tableOrders;
@FXML
public void clearAll(){
tableOrders.setItems(null);
}
PaymentsFXMLController.java
@FXML
private void finilizePayment(ActionEvent event){
// some code here
closeButtonAction();
}
@FXML
private void closeButtonAction(){
FXMLLoader loader = new FXMLLoader();
OrdersFXMLController orderController = (OrdersFXMLController)loader.getController();
orderController.clearAll();
}
And, here is the error code:
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Thanks in advance.