In my main class I have
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
public String versionNumber = "v2.1";
@Override
public void start(Stage primaryStage) throws Exception{
// SETTING UP THE STAGE
Stage window;
window = primaryStage;
window.setTitle("Support Tool " + versionNumber);
// SETTING UP THE SCENES
Parent parentNewCallDetails = FXMLLoader.load(getClass().getResource("newCallDetails.fxml"));
Scene scnNewCallDetails = new Scene (parentNewCallDetails, 800, 600);
// CHOOSING THE SCENE AND SHOWING THE STAGE
window.setScene(scnNewCallDetails);
window.show();
}
}
I essentially want to be able to access String versionNumber from within the following code in my FXML controller where I set the title of the next scene that I'm launching
public class newCallController {
// ACTION COMPLETED WHEN CALL BUTTON IS PRESSED
public void btnCall(MouseEvent event) throws IOException {
// TODO LAUNCH THE NEXT CALL WINDOW
Parent fxmlMainCallWindow = FXMLLoader.load(getClass().getResource("mainCallWindow.fxml"));
Scene scnMainCallWindow = new Scene(fxmlMainCallWindow, 1000, 800);
Stage window = (Stage)((Node)event.getSource()).getScene().getWindow();
// THIS IS WHERE I WANT TO ACCESS THE VERSIONNUMBER STRING
window.setTitle("Support Tool " + versionNumber);
window.setScene(scnMainCallWindow);
}
}