stage.setOpacity(0d);
stage.show();
final DoubleProperty opacity = stage.opacityProperty();
Timeline fadeIn = new Timeline(
new KeyFrame(Duration.ZERO, new KeyValue(opacity, 0d)),
new KeyFrame(new Duration(fadeInOutTime * 1000),
new EventHandler() {
@Override
public void handle(Event t) {
Timeline display = new Timeline(
new KeyFrame(Duration.ZERO, new KeyValue(opacity, 1d)),
new KeyFrame(new Duration((displayTime - fadeInOutTime * 2) * 1000),
new EventHandler() {
@Override
public void handle(Event t) {
Timeline fadeOut = new Timeline(
new KeyFrame(Duration.ZERO, new KeyValue(opacity, 1d)),
new KeyFrame(new Duration(fadeInOutTime * 1000),
new EventHandler() {
@Override
public void handle(Event t) {
stage.hide();
}
}, new KeyValue(opacity, 0d)));
fadeOut.play();
}
}, new KeyValue(opacity, 1d)));
display.play();
}
}, new KeyValue(opacity, 1d)));
fadeIn.play();
}
if (buttonSelected == -1) {
/* If a different type of button is designated the "cancel button",