start
start: (SwingTimer) -> ()Start it: the listener first runs the initial delay from now. Nothing when already running.
SwingTimer.new(…)| Method | Returns | Description |
|---|---|---|
start() | () | Start it: the listener first runs the initial delay from now. Nothing when already running. |
stop() | () | Stop it: the listener does not run again until it is started, and a run it posted that has not started yet does not run. |
restart() | () | Stop it and start it again: the next run is the initial delay from now. Called from the action, it lets the next expiry post another run ev… |
isRunning() | boolean | Whether it is running. |
setRepeats(boolean) | () | false: run once and stop. Set from the action of a repeating timer, the expiry already scheduled still runs. |
isRepeats() | boolean | Whether it repeats (the default). |
setDelay(number) | () | The delay between runs, ms, from the next rescheduling on: set from the action, it reaches the expiry after the next one. Negative is an er… |
getDelay() | number | The delay between runs, ms. |
setInitialDelay(number) | () | The delay before the first run after start, ms. Negative is an error. |
getInitialDelay() | number | The delay before the first run, ms. |
setCoalesce(boolean) | () | Whether expiries coalesce (the default): while a run it posted has not returned (it waits on a dialog, or has not started), an expiry posts… |
isCoalesce() | boolean | The coalesce flag. |
new(number, any) | SwingTimer | A stopped timer that, once started, calls listener delay ms later and then every delay ms (the initial delay and the delay are both `… |
| Method | Returns | Description |
|---|---|---|
SwingTimerClass.new | SwingTimer | A stopped timer that, once started, calls listener delay ms later and then every delay ms (the initial delay and the delay are both `… |
startstart: (SwingTimer) -> ()Start it: the listener first runs the initial delay from now. Nothing when already running.
stopstop: (SwingTimer) -> ()Stop it: the listener does not run again until it is started, and a run it posted that has not started yet does not run.
restartrestart: (SwingTimer) -> ()Stop it and start it again: the next run is the initial delay from now. Called from the action, it lets the next expiry post another run even while this one waits on a dialog.
isRunningisRunning: (SwingTimer) -> booleanWhether it is running.
setRepeatssetRepeats: (SwingTimer, boolean) -> ()false: run once and stop. Set from the action of a repeating timer, the expiry already scheduled still runs.
isRepeatsisRepeats: (SwingTimer) -> booleanWhether it repeats (the default).
setDelaysetDelay: (SwingTimer, number) -> ()The delay between runs, ms, from the next rescheduling on: set from the action, it reaches the expiry after the next one. Negative is an error.
getDelaygetDelay: (SwingTimer) -> numberThe delay between runs, ms.
setInitialDelaysetInitialDelay: (SwingTimer, number) -> ()The delay before the first run after start, ms. Negative is an error.
getInitialDelaygetInitialDelay: (SwingTimer) -> numberThe delay before the first run, ms.
setCoalescesetCoalesce: (SwingTimer, boolean) -> ()Whether expiries coalesce (the default): while a run it posted has not returned (it waits on a dialog, or has not started), an expiry posts nothing. false posts every expiry: runs stack up behind a busy cycle, and start while an earlier one waits on a dialog. An action that raises leaves a coalescing timer with a run that never returned, so it posts nothing more until stop() or restart().
isCoalesceisCoalesce: (SwingTimer) -> booleanThe coalesce flag.
newnew: (number, any) -> SwingTimerA stopped timer that, once started, calls listener delay ms later and then every delay ms (the initial delay and the delay are both delay, it repeats and coalesces). listener is an ActionListener: a function, or a table whose actionPerformed(self, event) is called; either gets the ActionEvent, whose getSource() is this timer. A negative delay is IllegalArgumentException.