< prev index next >
modules/javafx.graphics/src/main/java/com/sun/glass/ui/Timer.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 46,55 ****
--- 46,57 ----
private double period = UNSET_PERIOD;
protected abstract long _start(Runnable runnable);
protected abstract long _start(Runnable runnable, int period);
protected abstract void _stop(long timer);
+ protected abstract void _pause(long timer);
+ protected abstract void _resume(long timer);
/**
* Constructs a new timer.
*
* If the application overrides the Timer.run(), it should call super.run()
*** 131,140 ****
--- 133,163 ----
this.period = UNSET_PERIOD;
}
}
/**
+ * Pauses the timer. See JDK-8189926.
+ * Currently implemented only for mac platform.
+ * Timer can be paused or resumed from two different threads.
+ */
+ public synchronized void pause() {
+ if (ptr != 0L) {
+ _pause(ptr);
+ }
+ }
+
+ /**
+ * Resumes the timer. See JDK-8189926
+ */
+ public synchronized void resume() {
+ if (ptr != 0L) {
+ _resume(ptr);
+ }
+ }
+
+
+ /**
* Returns true if the timer is currently running
* (convenience API: might not need it)
*/
public synchronized boolean isRunning() {
return (this.period != UNSET_PERIOD);
< prev index next >