The run() method may be invoked on a thread other than the UI thread. If a developer wants to process timer events on the UI thread, they can use the Application.invokeLater/invokeAndWait() API.
| Modifier and Type | Field and Description |
|---|---|
| private double | |
| private long | |
| private final Runnable | |
| private static final double | |
| private static final double |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract void | |
| protected abstract void | |
| protected abstract long | |
| protected abstract long | |
| protected abstract void | |
| public static int | |
| public static int | |
| public synchronized boolean | |
| public synchronized void | |
| public synchronized void | |
| public synchronized void | |
| public synchronized void | |
| public synchronized void |
| period | back to summary |
|---|---|
| private double period | |
| ptr | back to summary |
|---|---|
| private long ptr | |
| runnable | back to summary |
|---|---|
| private final Runnable runnable | |
| SET_PERIOD | back to summary |
|---|---|
| private static final double SET_PERIOD
| |
| UNSET_PERIOD | back to summary |
|---|---|
| private static final double UNSET_PERIOD
| |
| Timer | back to summary |
|---|---|
| protected Timer(Runnable runnable) Constructs a new timer. If the application overrides the Timer.run(), it should call super.run() in order to run the runnable passed to the constructor. | |
| _pause | back to summary |
|---|---|
| protected abstract void _pause(long timer) | |
| _resume | back to summary |
|---|---|
| protected abstract void _resume(long timer) | |
| _start | back to summary |
|---|---|
| protected abstract long _start(Runnable runnable) | |
| _start | back to summary |
|---|---|
| protected abstract long _start(Runnable runnable, int period) | |
| _stop | back to summary |
|---|---|
| protected abstract void _stop(long timer) | |
| getMaxPeriod | back to summary |
|---|---|
| public static int getMaxPeriod() Returns the maximum timer period supported by the native system. | |
| getMinPeriod | back to summary |
|---|---|
| public static int getMinPeriod() Returns the minimum timer period supported by the native system. | |
| isRunning | back to summary |
|---|---|
| public synchronized boolean isRunning() Returns true if the timer is currently running (convenience API: might not need it) | |
| pause | back to summary |
|---|---|
| public synchronized void pause() Pauses the timer. See JDK-8189926. Timer is paused only from the timer thread. | |
| resume | back to summary |
|---|---|
| public synchronized void resume() Resumes the timer. See JDK-8189926 Timer can get resumed from different threads. | |
| start | back to summary |
|---|---|
| public synchronized void start(int period) Starts the timer. The period must be in the range getMinPeriod() .. getMaxPeriod(). If the timer is currently started, it gets stopped before re-starting. If starting the timer fails, the RuntimeException is thrown. | |
| start | back to summary |
|---|---|
| public synchronized void start() Start a vsync-based timer if the system supports it. A RuntimeException is thrown if the system does not support vsync-based timer or if there was an issue starting the timer. | |
| stop | back to summary |
|---|---|
| public synchronized void stop() Stops the timer. If a vsync-based timer is stopped, all of the vsync timers currently running will be stopped. | |