I\'m using Netbeans 7.2 with Scene Builder 1.0 to develop a JavaFX application. I have my main screen set up, and I want to have it so I click a button and it\'ll close the main
I'm probably saying something similar here, but this is how I do it:
(In this example, I am transitioning from Login.fxml to Home.fxml).
Inside the LoginController.fxml class, I have created the following method:
@FXML
private void login(javafx.event.ActionEvent event) throws IOException
{
if(pwf1.getText().equals("dolphin"))
{
Parent blah = FXMLLoader.load(getClass().getResource("Home.fxml"));
Scene scene = new Scene(blah);
Stage appStage = (Stage) ((Node) event.getSource()).getScene().getWindow();
appStage.setScene(scene);
appStage.show();
}
else
{
label1.setText("Password is incorrect. Please Try Again");
}
}
And that's it.;)