Q:

JavaFX Alerts not showing?

I don't have quite much information, but perhaps someone was facing the same problem. I wrote an application for some friends, and it includes some Alert Dialogues. The problem is that the alerts are not showing on one of the pcs it was tested (but on my pc, it does!). I have Windows 10 and Java 1.8.0_51, the testing system had Windows 7 and Java 1.8.0_60.
I styled it with css. This is how I implemented it (alarm is just an audioclip):
public void play(Stage stage, Callable<Void> func){
        if (alert == null) {
            alert = new Alert(AlertType.INFORMATION);
            alert.setTitle("Alarm");
            alert.setHeaderText(LanguageLoader.getInstance().getLocalizedString("alarmDialog"));
            alert.initOwner(stage);
            alarm.setCycleCount(Timeline.INDEFINITE);
        }

        if (!alert.isShowing()) {
            alarm.play();
            stage.toFront();
            stage.requestFocus();
            Optional<ButtonType> result = alert.showAndWait();
            if (result.get() == ButtonType.OK) {
                alarm.stop();
                try {
                    func.call();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }else{
            alert.show();
        }
    }

Edit: I updated to 1.8.0_60 too, and the dialog isn't showing on my system either! 
This is the exception I get:
Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: showAndWait is not allowed during animation or layout processing
    at javafx.scene.control.Dialog.showAndWait(Unknown Source)
    at utils.Alarm.play(Alarm.java:38)
    at note.NoteController.update(Controller.java:76)
    at java.util.Observable.notifyObservers(Unknown Source)
    at java.util.Observable.notifyObservers(Unknown Source)
    at note.NoteModel.update(Model.java:57)
    at java.util.Observable.notifyObservers(Unknown Source)
    at java.util.Observable.notifyObservers(Unknown Source)
    at utils.Watch.lambda$0(Clock.java:35)
    at com.sun.scenario.animation.shared.TimelineClipCore.visitKeyFrame(Unknown Source)
    at com.sun.scenario.animation.shared.TimelineClipCore.playTo(Unknown Source)
    at javafx.animation.Timeline.impl_playTo(Unknown Source)
    at javafx.animation.AnimationAccessorImpl.playTo(Unknown Source)
    at com.sun.scenario.animation.shared.InfiniteClipEnvelope.timePulse(Unknown Source)
    at javafx.animation.Animation.impl_timePulse(Unknown Source)
    at javafx.animation.Animation$1.lambda$timePulse$26(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javafx.animation.Animation$1.timePulse(Unknown Source)
    at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(Unknown Source)
    at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(Unknown Source)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source)
    at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$405(Unknown Source)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$149(Unknown Source)

I use a timeline in the class Clock.. I guess that's the problem. can I build a working clock without using timeline?

A:

It seemes like in Java 1.8.0_60, the showAndWait() method of the class Alert can't be called during an animation (basically that's what the exception says). The problem was that I used a timeline to check the system time, and showed an alarm when a certain time is reached. To solve the problem, I changed
Optional<ButtonType> result = alert.showAndWait();
            if (result.get() == ButtonType.OK) {
                alarm.stop();
                try {
                    func.call();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

to this:
alert.showingProperty().addListener((observable,oldValue,newValue)->{
                if (!newValue){
                    alarm.stop();
                    try {
                        func.call();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });

So instead of waiting for some input, it simply listens to changes in the showing property. Don't know how to fix this if you use other alerts with more buttons though.

