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)

1  
static S lineAtMouse() {
2  
  ret swing(func -> S {
3  
    Component c = (Component) componentAtMouse_gen();
4  
    if (c instanceof JLabel)
5  
      ret getText((JLabel) c);
6  
      
7  
    if (c instanceof JTextComponent) {
8  
      JTextComponent tc = cast c;
9  
      Point d = mouseToComponent(c);
10  
      int idx = tc.viewToModel(d);
11  
      S text = tc.getText();
12  
      ret lineAroundIndex(text, idx);
13  
    }
14  
    ret "";
15  
  });
16  
}

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: 373 / 402
Version history: 1 change(s)
Referenced in: [show references]