1

So I'm trying to open a second JavaFX window on a specific button click to perform a separate function. How should I proceed given the code below from my MainGUI and attempting to link a class titled NearLocationsGUI which would open when the button is clicked:

        Button nearMe = new Button();
        nearMe.setText("Find Locations Near Me");


        nearMe.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Locations Near Me Found!");
                NearestLocationsGUI.launch();
            }
        });

Not a duplicate of this post: JavaFX open new window because that was working with FXML, which I am not, and creating a new window in the same class, I have an in depth second class I need to open- almost like a second application.

Community
  • 1
  • 1
SN44
  • 23
  • 8

1 Answers1

2

You just have create a new stage then say newStage.show();

MadMax
  • 605
  • 1
  • 6
  • 19