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

sclass ImageSurface_PositionToolTip > ImageSurfaceMouseHandler {
  *(ImageSurface is) {
    if (containsInstance(is.tools, ImageSurface_PositionToolTip)) ret;
    register(is);
  }

  public void mouseMoved aka mouseDragged(MouseEvent e) {
    pcall {
      Pt p = getPt(e);
      S s = str(p);
      var img = is.getImage();
      if (img != null && p.x >= 0 && p.y >= 0
        && p.x < img.getWidth() && p.y < img.getHeight()) {
        IToolTipMaker toolTipMaker = lookupDynamicInterface_v2 IToolTipMaker(img);
        if (toolTipMaker != null)
          s = toolTipMaker.getToolTip(p);
        else
          s += " - " + intToHex_fullLength(img.getRGB(p.x, p.y));
      }
      setToolTip(is, s);
    }
  }
}

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: 177 / 320
Version history: 8 change(s)
Referenced in: #1033812 - ImageSurface_HighlightRegion
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)
#1035595 - ImageSurface_PositionToolTip (backup)