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)

1  
ifndef NoAWT
2  
static void cancelTimer(javax.swing.Timer timer) {
3  
  if (timer != null) timer.stop();
4  
}
5  
endifndef
6  
7  
static void cancelTimer(java.util.Timer timer) {
8  
  if (timer != null) timer.cancel();
9  
}
10  
11  
static void cancelTimer(O o) {
12  
  if (o instanceof java.util.Timer) cancelTimer((java.util.Timer) o);
13  
  ifndef NoAWT
14  
  else if (o instanceof javax.swing.Timer) cancelTimer((javax.swing.Timer) o);
15  
  endifndef
16  
  else if (o instanceof AutoCloseable) pcall { ((AutoCloseable) o).close(); }
17  
}

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: 692 / 913
Version history: 7 change(s)
Referenced in: [show references]