I understand how to pass a value between two forms ala https://www.youtube.com/watch?v=HFAsMWkiLvg
The problem is in the way it is done in the video. (Being static that is). I was unable to get FXMLLoaders to work when inside of a static method because of the usage of the getClass() method. It is non-static only.
getClass().getResource("myFile.fxml")
Here is how I am loading my second form.
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("LoginForm.fxml"));
Parent root1 = (Parent) fxmlLoader.load();
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setTitle("HWI - Login");
stage.setResizable(false);
stage.setScene(new Scene(root1));
stage.showAndWait();
} catch (Exception e) {
e.printStackTrace();
}
Inside of scenebuilder I am setting the method to be run where it's essentially checking against a DB for a username/password. All of this is done within my loginController class. Once successful it does this. (Above I have my @FXML hook declared for loginButton)
Stage stage = (Stage) loginButton.getScene().getWindow();
stage.close();
The current way I have the program setup is that all of the menus are set to disabled before the user is signed in. I have a non-static method already setup to re-enable everything but I'm unable to call it because I can't bridge the gap between static / non-static before closing my 2nd window.
Thanks,