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

27
LINES

< > BotCompany Repo | #1007429 // Test componentAtMouse + wordAtMouse

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (4200L/30K).

!7

p-subst {
  swing {
    JTable tbl = sexyTable();
    dataToTable(tbl, litmap(aGlobalID(), aGlobalID(), aGlobalID(), aGlobalID()));
    addToWindowBottomHalf(showText(lines(repF(10, f aGlobalID))), tbl);
  }
    
  repeat with ms sleep 500 {
    awt {
      Component c = componentAtMouse();
      if (c != null) {
        Point d = mouseToComponent(c);
        print("Mouse: " + d.x + ", " + d.y + ": " + c);
        if (c instanceof JTextComponent) {
          JTextComponent tc = cast c;
          int idx = tc.viewToModel(d);
          S text = tc.getText();
          S word = wordAtMouse();
          print("  " + quote(word) + " / " + quote(substring(text, idx-1, idx+1)));
        }
      } else
        print("Mouse: " + c);
    }
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007429
Snippet name: Test componentAtMouse + wordAtMouse
Eternal ID of this version: #1007429/17
Text MD5: c2fcc0f3ea60c0f0476c92653fb39e6d
Transpilation MD5: 7ab0b24c1f7d4292fd829754968601f6
Author: stefan
Category: javax / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-23 14:48:49
Source code size: 775 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 444 / 934
Version history: 16 change(s)
Referenced in: [show references]