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

23
LINES

< > BotCompany Repo | #1033810 // ImageSurface_PositionToolTip

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

Libraryless. Click here for Pure Java version (29610L/190K).

1  
sclass ImageSurface_PositionToolTip > ImageSurfaceMouseHandler {
2  
  *(ImageSurface is) {
3  
    if (containsInstance(is.tools, ImageSurface_PositionToolTip)) ret;
4  
    register(is);
5  
  }
6  
7  
  public void mouseMoved aka mouseDragged(MouseEvent e) {
8  
    pcall {
9  
      Pt p = getPt(e);
10  
      S s = str(p);
11  
      var img = is.getImage();
12  
      if (img != null && p.x >= 0 && p.y >= 0
13  
        && p.x < img.getWidth() && p.y < img.getHeight()) {
14  
        IToolTipMaker toolTipMaker = lookupDynamicInterface_v2 IToolTipMaker(img);
15  
        if (toolTipMaker != null)
16  
          s = toolTipMaker.getToolTip(p);
17  
        else
18  
          s += " - " + intToHex_fullLength(img.getRGB(p.x, p.y));
19  
      }
20  
      setToolTip(is, s);
21  
    }
22  
  }
23  
}

Author comment

Began life as a copy of #1008773

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033810
Snippet name: ImageSurface_PositionToolTip
Eternal ID of this version: #1033810/9
Text MD5: e55deebb00decdf4a579c02119cb6343
Transpilation MD5: fec168df4f0706bc78586ebcfa3e07e1
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-26 15:14:25
Source code size: 736 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 176 / 320
Version history: 8 change(s)
Referenced in: [show references]