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

16
LINES

< > BotCompany Repo | #1016636 // lineAtMouse (current VM only)

JavaX fragment (include)

static S lineAtMouse() {
  ret swing(func -> S {
    Component c = (Component) componentAtMouse_gen();
    if (c instanceof JLabel)
      ret getText((JLabel) c);
      
    if (c instanceof JTextComponent) {
      JTextComponent tc = cast c;
      Point d = mouseToComponent(c);
      int idx = tc.viewToModel(d);
      S text = tc.getText();
      ret lineAroundIndex(text, idx);
    }
    ret "";
  });
}

Author comment

Began life as a copy of #1007432

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016636
Snippet name: lineAtMouse (current VM only)
Eternal ID of this version: #1016636/2
Text MD5: 964eb4fe1c457129ef717f611ca976a1
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-26 14:00:01
Source code size: 422 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 296 / 327
Version history: 1 change(s)
Referenced in: [show references]