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

24
LINES

< > BotCompany Repo | #1019911 // imageSurfaceOnMouseMoveOrDrag

JavaX fragment (include)

1  
// f : voidfunc(Pt) - point can be null, then mouse has exited
2  
static void imageSurfaceOnMouseMoveOrDrag(final ImageSurface is, final O f) {
3  
  swing {
4  
    MouseAdapter ma = new MouseAdapter {
5  
      public void mouseMoved(MouseEvent e) {
6  
        pcallF(f, is.pointFromEvent(e));
7  
      }
8  
      
9  
      public void mouseDragged(MouseEvent e) {
10  
        pcallF(f, is.pointFromEvent(e));
11  
      }
12  
      
13  
      public void mouseEntered(MouseEvent e) {
14  
        pcallF(f, is.pointFromEvent(e));
15  
      }
16  
  
17  
      public void mouseExited(MouseEvent e) {
18  
        pcallF(f, (Pt) null);
19  
      }
20  
    };
21  
    is.addMouseMotionListener(ma);
22  
    is.addMouseListener(ma);
23  
  }
24  
}

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: #1019911
Snippet name: imageSurfaceOnMouseMoveOrDrag
Eternal ID of this version: #1019911/1
Text MD5: 1cbf17387ccf590b54e2976f82ee1420
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-30 21:49:19
Source code size: 678 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 292 / 325
Referenced in: [show references]