1

I want to update my fxml after adding data in it.while clicking on add button in priceaddonn.fxml data should be transmitted to Sys1.fxml and table should be updated as per priceAddOnn.fxml input

PriceAddOnController.java

 @FXML
 public void handleAddOnButtonAction(ActionEvent a) {
   try {           
            Stage  stage = new Stage();
            FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Sys1.fxml"));
            Parent root44 = (Parent) fxmlLoader.load();   
            Sys1Controller controller=fxmlLoader.<Sys1Controller>getController();             
            stage.setScene(new Scene(root44));               
            //stage.show();
            System.out.println("handleAddOnButtonAction get over extr a var is "+controller.nm);
            System.out.println("call function");
            controller.priceadd();              
        } catch (IOException ex) {
        Logger.getLogger(Sys1Controller.class.getName()).log(Level.SEVERE, null, ex);
    }        
}

Sys1Controller.java

public void priceadd() {       
    try {
            Stage stage = new Stage();
            FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("PriceAddonn.fxml"));
            Parent root44 = (Parent) fxmlLoader.load();   
            PriceAddonnController controller=fxmlLoader.<PriceAddonnController>getController();             
            stage.setScene(new Scene(root44));               
            controller.getData();
            data.add(new Person1(controller.charge_nm,controller.chrgeval,controller.var,"Tax"));                       
        System.out.println(" charge nm is "+controller.chrgenm);
    } catch (IOException ex) {
        Logger.getLogger(Sys1Controller.class.getName()).log(Level.SEVERE, null, ex);
    }
}
AlBlue
  • 23,254
  • 14
  • 71
  • 91
Drashti Pandya
  • 348
  • 1
  • 5
  • 15
  • Possible duplicate of [javafx2.0 - force refresh the scene](http://stackoverflow.com/questions/19153036/javafx2-0-force-refresh-the-scene) – Evan Carslake May 09 '16 at 19:51

0 Answers0