Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1009857 // cancelTimer - cancel javax.swing.Timer or java.util.Timer - also takes AutoCloseable

JavaX fragment (include)

ifndef NoAWT
static void cancelTimer(javax.swing.Timer timer) {
  if (timer != null) timer.stop();
}
endifndef

static void cancelTimer(java.util.Timer timer) {
  if (timer != null) timer.cancel();
}

static void cancelTimer(O o) {
  if (o instanceof java.util.Timer) cancelTimer((java.util.Timer) o);
  ifndef NoAWT
  else if (o instanceof javax.swing.Timer) cancelTimer((javax.swing.Timer) o);
  endifndef
  else if (o instanceof AutoCloseable) pcall { ((AutoCloseable) o).close(); }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1009857
Snippet name: cancelTimer - cancel javax.swing.Timer or java.util.Timer - also takes AutoCloseable
Eternal ID of this version: #1009857/8
Text MD5: 0ab7e43067c2d7f516804da87e99bdd9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-15 13:29:02
Source code size: 503 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 447 / 662
Version history: 7 change(s)
Referenced in: [show references]