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

15
LINES

< > BotCompany Repo | #1034169 // onMouseDown_anyButton

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

Libraryless. Click here for Pure Java version (4753L/26K).

static MouseAdapter onMouseDown_anyButton(Component c, Runnable r) {
  ret onMouseDown(c, runnableToIVF1(r));
}

static MouseAdapter onMouseDown_anyButton(Component c, IVF1<MouseEvent> f) {
  ret c == null || f == null ?: swing(-> {
    MouseAdapter ma = new {
      public void mousePressed(MouseEvent e) {
        f.get(e);
      }
    };
    c.addMouseListener(ma);
    ret ma;
  });
}

Author comment

Began life as a copy of #1018604

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034169
Snippet name: onMouseDown_anyButton
Eternal ID of this version: #1034169/1
Text MD5: c98313f48a9592b701604c42d1f7d83d
Transpilation MD5: d3f3887e5af520a8d4b9e44fc745bec5
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-25 18:17:03
Source code size: 402 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 123 / 195
Referenced in: [show references]