There are 2 forms, forms have different controller classes, 1 form loads another one by pressing a button. How to send 2 form information from 1 form.
To change forms I use - there is a static Stage on which I am changing the Scene:
public static Stage primaryStage; @Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("/sample/sample.fxml")); primaryStage.setScene(new Scene(root)); runStage(primaryStage); } public static void runStage(Stage stage) throws IOException { primaryStage = stage; primaryStage.show(); } public static void main(String[] args) { launch(args); } Change the form by clicking on the button:
public void EditBook() throws IOException { Parent root = FXMLLoader.load(getClass().getResource("/sample/EditBook.fxml")); Main.primaryStage.setScene(new Scene(root)); Main.primaryStage.show(); } I would like to know how to correctly change the forms and see an example of the interaction between the forms.