Skip to content

how to pause #71

@mokun

Description

@mokun

How do I pause and resume using Timer ?

I followed your approach in http://tomasmikula.github.io/blog/2014/06/04/timers-in-javafx-and-reactfx.html

In javafx, I can do

Timeline autosaveTimer = new Timeline(
				new KeyFrame(Duration.seconds(60 * MINUTES),
						ae -> masterClock.setSaveSim(DEFAULT))); 

At some point I have to call autosaveTimer().pause() to pause

and later call autosaveTimer().play() to resume

In ReactFX, I do the following

Timer autosaveTimer = FxTimer.runLater(
    				java.time.Duration.ofMinutes(60 * MINUTES),
    		        () -> masterClock.setSaveSim(DEFAULT)));

I notice there is a stop() and restart() for Timer

but I don't want to stop autosaveTimer completely and restart from the beginning of MINUTES. I want to resume from whatever MINUTES has elapsed.

Is there a pause() and resume() that I can call ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions