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

23
LINES

< > BotCompany Repo | #1032114 // addAWTEventListener_inFront - add global AWT listener in front of all others

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

Libraryless. Click here for Pure Java version (3655L/20K).

1  
svoid addAWTEventListener_inFront(AWTEventListener listener, long eventMask) {
2  
  if (listener == null) ret;
3  
  swing {
4  
    var tk = awtToolkit();
5  
    EventListener[] otherListeners = tk.getAWTEventListeners();
6  
    
7  
    new LPair<AWTEventListener, Long> listenersWithMask;
8  
    
9  
    fOr (var l : otherListeners)
10  
      if (l cast AWTEventListenerProxy) {
11  
        listenersWithMask.add(pair(l.getListener(), l.getEventMask()));
12  
      } else {
13  
        warn("Can't get event listener mask: " + l);
14  
        ret;
15  
      }
16  
17  
    fOr (var l : listenersWithMask)
18  
      tk.removeAWTEventListener(l.a);
19  
    tk.addAWTEventListener(listener, eventMask);
20  
    fOr (var l : listenersWithMask)
21  
      tk.addAWTEventListener(l.a, l.b);
22  
  }
23  
}

Author comment

Began life as a copy of #1032112

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032114
Snippet name: addAWTEventListener_inFront - add global AWT listener in front of all others
Eternal ID of this version: #1032114/7
Text MD5: dc6ce73fde2728a3ac87fbb0d47dd629
Transpilation MD5: 9cd555aaa467e520f0b6c89c444bbe07
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-14 00:37:57
Source code size: 739 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 171 / 254
Version history: 6 change(s)
Referenced in: [show references]