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

12
LINES

< > BotCompany Repo | #1035436 // tempOnFrameClose

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7906L/45K).

static AutoCloseable tempOnFrameClose(JFrame f, Runnable r) {
  if (f == null || r == null) null;
  ret swing(-> {
    var listener = new WindowAdapter {
      public void windowClosing(WindowEvent e) {
        pcall-messagebox { r.run(); }
      }
    };
    f.addWindowListener(listener);
    ret -> swing { f.removeWindowListener(listener); };
  });
}

Author comment

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