title: Does JavaFX provide a mechanism to check if a Stage is already open?
body: <p>In my application I have created two separate launchers for window types.  Either the process is a Single Page Application (SPA) or a Multi Document Interface. </p>
  
  <p>To ensure that these windows are managed correctly I have provided a launcher similar to the following:</p>
  
  <pre><code>public static void openSPA(String spaFXML, String windowTitle, String iconString, double x, double y) {
          try {
              FXMLLoader loader = new FXMLLoader();
              Parent node = loader.load(SPALauncher.class.getClassLoader().getResource(spaFXML).openStream());
              Scene scene = new Scene(node);
              scene.getStylesheets().add(SPALauncher.class.getClassLoader().getResource("css/application.css").toExternalForm());
  
              Stage stage = new Stage();
              SPAControllerBase controller = (SPAControllerBase)loader.getController();
  
              controller.setScene(scene);
              controller.setPrimaryStage(stage);
              controller.buildAvailableLayoutMenu();
              stage.setTitle(windowTitle);
              stage.setScene(scene);
              stage.setX(x);
              stage.setY(y);
  
              stage.getIcons().add(new Image(iconString));
              stage.show();
  
              controller.initSPA();
  
          }catch(Exception e){
              //process the error
          }
      }
  </code></pre>
  
  <p>Without keeping a reference to the window that has been opened, is there a way to look for the stage in the JVM already?  Basically, if the user attempts to open the same window again, I would rather bring it into focus - not open it a second time.  Since the user may open the same stage in different contexts, I would want to look based on the title (which would be unique) and either open or bring forward.</p>
  
  <p>I know I can keep references, but then I need to manage removing them as well, which I can do...  Just wondering if there was a better way?</p>
  
  <p>Thanks!</p>