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

32
LINES

< > BotCompany Repo | #1006660 // onLeftClick

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

Transpiled version (5211L) is out of date.

// runnable can take an argument (Pt)
static <A extends JComponent> A onLeftClick(final A c, fO runnable) {
  swing {
    c.addMouseListener(leftClickMouseAdapter(runnable));
  }
  ret c;
}

// runnable takes no args
static TrayIcon onLeftClick(final TrayIcon c, final O runnable) {
  swing {
    c.addMouseListener(leftClickMouseAdapter_noPt(runnable));
  }
  ret c;
}


static <A extends JComponent> A onLeftClick(fO runnable, A c) {
  ret onLeftClick(c, runnable);
}

static <A extends JComponent> A onLeftClick(Runnable runnable, A c) {
  ret onLeftClick((O) runnable, c);
}

static <A extends JComponent> A onLeftClick(A c, Runnable r) {
  ret onLeftClick(r, c);
}

static <A extends JComponent> A onLeftClick(A c, IVF1<Pt> r) {
  ret onLeftClick(c, (O) r);
}

Author comment

Began life as a copy of #1005614

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006660
Snippet name: onLeftClick
Eternal ID of this version: #1006660/16
Text MD5: 7cfe1ea7babcf8fcc1095a9b4d972836
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-06 00:26:55
Source code size: 795 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 626 / 682
Version history: 15 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1007224 - onSingleLeftClick