Transpiled version (45L) is out of date.
1 | // Window must be made visible before calling this. |
2 | static void disposeWindowOnClick(final Window window) { |
3 | AWTEventListener l = new AWTEventListener { |
4 | public void eventDispatched(AWTEvent evt) { |
5 | if (!window.isVisible()) { |
6 | //print("disposeWindowOnClick: Forgetting listener"); |
7 | Toolkit.getDefaultToolkit().removeAWTEventListener(this); |
8 | ret; |
9 | } |
10 | |
11 | if (!evt instanceof MouseEvent) ret; |
12 | O source = evt.getSource(); |
13 | if (source == window && evt.getID() == MouseEvent.MOUSE_PRESSED) { |
14 | Toolkit.getDefaultToolkit().removeAWTEventListener(this); |
15 | window.dispose(); |
16 | } |
17 | } |
18 | }; |
19 | Toolkit.getDefaultToolkit().addAWTEventListener(l, AWTEvent.MOUSE_EVENT_MASK); |
20 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1003983 |
Snippet name: | disposeWindowOnClick - reacts to click in any point in the window |
Eternal ID of this version: | #1003983/3 |
Text MD5: | 3f1ae7075cb518ad4257465806b3a2f1 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-15 03:47:59 |
Source code size: | 755 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 694 / 698 |
Version history: | 2 change(s) |
Referenced in: | [show references] |