I'm using this example to create application modal dialog. When I click exit button on my dialog (red one in top right corner) everything works fine. Dialog gets closed and then I can open it normaly. But when I try to add a Button
which closes my dialog, everything works fine until I try to reopen it. After that, it throws me a IllegalStateException
(I'll update answer with this exception if needed).
This is an event handler which demonstrates how I close a dialog:
btnClose.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
dialog.close();
}
});
Can someone tell me how to properly close application modal dialog? Thanks in advance.