Libraryless. Click here for Pure Java version (7906L/45K).
1 | static AutoCloseable tempOnFrameClose(JFrame f, Runnable r) {
|
2 | if (f == null || r == null) null; |
3 | ret swing(-> {
|
4 | var listener = new WindowAdapter {
|
5 | public void windowClosing(WindowEvent e) {
|
6 | pcall-messagebox { r.run(); }
|
7 | } |
8 | }; |
9 | f.addWindowListener(listener); |
10 | ret -> swing { f.removeWindowListener(listener); };
|
11 | }); |
12 | } |
Began life as a copy of #1001031
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035436 |
| Snippet name: | tempOnFrameClose |
| Eternal ID of this version: | #1035436/3 |
| Text MD5: | 6f36c645cf555e4b83c6118e9eb71bfa |
| Transpilation MD5: | 247d6e14e139edbe4ada151ff7bb01de |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-05-08 23:13:45 |
| Source code size: | 365 bytes / 12 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 363 / 466 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |