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).

1  
svoid imageSurfaceOnLeftClick(ImageSurface is, VF1<Pt> onClick) {
2  
  if (is == null || onClick == null) ret;
3  
  swing {
4  
    MouseAdapter ma = new MouseAdapter {
5  
      public void mouseClicked(MouseEvent e) {
6  
        print ifdef imageSurfaceOnLeftClick_debug("imageSurfaceOnLeftClick mouseClicked: " + e);
7  
        if (e.getButton() == 1)
8  
          pcallF(onClick, is.pointFromEvent(e));
9  
      }
10  
    };
11  
    is.addMouseListener(ma);
12  
  }
13  
}
14  
15  
svoid imageSurfaceOnLeftClick(ImageSurface is, IVF1<Pt> onClick) {
16  
  imageSurfaceOnLeftClick(is, toVF1(onClick));
17  
}

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: 171 / 259
Version history: 5 change(s)
Referenced in: [show references]