Transpiled version (45L) is out of date.
// Window must be made visible before calling this. static void disposeWindowOnClick(final Window window) { AWTEventListener l = new AWTEventListener { public void eventDispatched(AWTEvent evt) { if (!window.isVisible()) { //print("disposeWindowOnClick: Forgetting listener"); Toolkit.getDefaultToolkit().removeAWTEventListener(this); ret; } if (!evt instanceof MouseEvent) ret; O source = evt.getSource(); if (source == window && evt.getID() == MouseEvent.MOUSE_PRESSED) { Toolkit.getDefaultToolkit().removeAWTEventListener(this); window.dispose(); } } }; Toolkit.getDefaultToolkit().addAWTEventListener(l, AWTEvent.MOUSE_EVENT_MASK); }
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: | 695 / 698 |
Version history: | 2 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1020885 - tempAddGlobalMouseListener - add a global AWT mouse event listener (just clicks, not motion) |