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

16
LINES

< > BotCompany Repo | #1018604 // onMouseDown (left button only)

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

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

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

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

Author comment

Began life as a copy of #1015170

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018604
Snippet name: onMouseDown (left button only)
Eternal ID of this version: #1018604/7
Text MD5: b067075d5a3daaf53328143c0517aa84
Transpilation MD5: 710f7b3c346127676accab9214e0779f
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:16:38
Source code size: 434 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 337 / 428
Version history: 6 change(s)
Referenced in: [show references]