(ActionEvent event)
| 84 | KeyFrame keyFrame = new KeyFrame(Duration.millis(1000), |
| 85 | new EventHandler<ActionEvent>() { |
| 86 | public void handle(ActionEvent event) { |
| 87 | long startNanoTime = System.nanoTime(); |
| 88 | try { |
| 89 | sketch.handleDraw(); |
| 90 | } catch (Throwable e) { |
| 91 | // Let exception handler thread crash with our exception |
| 92 | drawExceptionQueue.offer(e); |
| 93 | // Stop animating right now so nothing runs afterwards |
| 94 | // and crash frame can be for example traced by println() |
| 95 | animation.stop(); |
| 96 | return; |
| 97 | } |
| 98 | long drawNanos = System.nanoTime() - startNanoTime; |
| 99 | |
| 100 | if (sketch.exitCalled()) { |
| 101 | // using Platform.runLater() didn't work |
| 102 | // Platform.runLater(new Runnable() { |
| 103 | // public void run() { |
| 104 | // instead of System.exit(), safely shut down JavaFX this way |
| 105 | Platform.exit(); |
| 106 | // } |
| 107 | // }); |
| 108 | } |
| 109 | if (sketch.frameCount > 5) { |
| 110 | animation.setRate(-PApplet.min(1e9f / drawNanos, frameRate)); |
| 111 | } |
| 112 | } |
| 113 | }); |
| 114 | animation = new Timeline(keyFrame); |
| 115 | animation.setCycleCount(Animation.INDEFINITE); |
nothing calls this directly
no test coverage detected