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

13
LINES

< > BotCompany Repo | #1019902 // callFunctionOnMouseMove (dev.)

JavaX fragment (include)

// f : voidfunc(Pt) - point can be null, then mouse has exited
static <A extends JComponent> A callFunctionOnMouseMove(final A c, final O f) {
  if (c != null && f != null) swing {
    MouseAdapter ma = new MouseAdapter {
      public void mouseMoved(MouseEvent e) { pcallF(f, is.pointFromEvent(e)); }
      public void mouseEntered(MouseEvent e) { pcallF(f, is.pointFromEvent(e)); }
      public void mouseExited(MouseEvent e) { pcallF(f, (Pt) null); }
    };
    c.addMouseMotionListener(ma);
    c.addMouseListener(ma);
  }
  ret c;
}

Author comment

Began life as a copy of #1005948

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019902
Snippet name: callFunctionOnMouseMove (dev.)
Eternal ID of this version: #1019902/2
Text MD5: 3e26bc0b52f644761e9f4a9a6ad6ef32
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-18 14:47:44
Source code size: 549 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 315 / 327
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)