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

17
LINES

< > BotCompany Repo | #1024682 // imageSurfaceOnLeftClick

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

Libraryless. Click here for Pure Java version (25246L/160K).

svoid imageSurfaceOnLeftClick(ImageSurface is, VF1<Pt> onClick) {
  if (is == null || onClick == null) ret;
  swing {
    MouseAdapter ma = new MouseAdapter {
      public void mouseClicked(MouseEvent e) {
        print ifdef imageSurfaceOnLeftClick_debug("imageSurfaceOnLeftClick mouseClicked: " + e);
        if (e.getButton() == 1)
          pcallF(onClick, is.pointFromEvent(e));
      }
    };
    is.addMouseListener(ma);
  }
}

svoid imageSurfaceOnLeftClick(ImageSurface is, IVF1<Pt> onClick) {
  imageSurfaceOnLeftClick(is, toVF1(onClick));
}

Author comment

Began life as a copy of #1024565

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024682
Snippet name: imageSurfaceOnLeftClick
Eternal ID of this version: #1024682/6
Text MD5: c13274d46e5d01ade5fa846859fdb0d6
Transpilation MD5: cef82fda6a260028e38f547fb28bbfc4
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-11 21:18:10
Source code size: 566 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 249 / 360
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1033920 - imageSurfaceOnLeftMouseDown