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

11
LINES

< > BotCompany Repo | #1032112 // addMouseListener_inFront - add MouseListener in front of listeners list

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

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

1  
svoid addMouseListener_inFront(JComponent c, MouseListener listener) {
2  
  if (c == null || listener == null) ret;
3  
  swing {
4  
    var otherListeners = c.getListeners(MouseListener.class);
5  
    fOr (MouseListener l : otherListeners)
6  
      c.removeMouseListener(l);
7  
    c.addMouseListener(listener);
8  
    fOr (MouseListener l : otherListeners)
9  
      c.addMouseListener(l);
10  
  }
11  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1032112
Snippet name: addMouseListener_inFront - add MouseListener in front of listeners list
Eternal ID of this version: #1032112/1
Text MD5: 26fc2ab98d979aa7ac1a7030a196e638
Transpilation MD5: 049425e591caf14e285811d4085b6406
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-13 23:41:56
Source code size: 381 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 148 / 217
Referenced in: [show references]