Minha classe está assim:
public class FormSucessoConfirmacao extends Application {
static Stage tela;
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLFormSucessoConfirmacao.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setTitle("Mensagem do sistema...");
stage.setResizable(false);
stage.initModality(Modality.APPLICATION_MODAL);
stage.showAndWait();
tela = stage;
}}
A programação do botão está da seguinte maneira:
@FXML
public void fecharTela() {
FormSucessoConfirmacao.tela.close();
}
O problema se encontrou quando mudei de .show() para .showAndWait(), após isso não consegui mais fechar o meu modal com o mesmo comando…