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

28
LINES

< > BotCompany Repo | #1015337 // Display snippet source on hover action

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

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

1  
!7
2  
3  
static double delay = 1.0; // need 1 second hover before showing source code
4  
static JFrame frame;
5  
static new RestartableCountdown countdown;
6  
static S snippetToShow;
7  
8  
p-subst-autorestart {
9  
  onLocalMechAppend("Mouse hovers", vf1(f update));
10  
}
11  
12  
svoid update(S s) {
13  
  //infoBox(s);
14  
  bool off = jfind(s, "no longer") >= 0;
15  
  if (off) { print("off"); countdown.stop(); }
16  
  else {
17  
    final TextImageAction tia = jextractSerializedObject(s, TextImageAction);
18  
    if (tia != null && isSnippetID(tia.toolTip))
19  
      countdown.start(delay, r {
20  
        snippetToShow = tia.toolTip;
21  
        fS text = loadSnippet_cached(tia.toolTip);
22  
        if (nempty(text)) swing {
23  
          if (eq(snippetToShow, tia.toolTip))
24  
            frame = showFrame(snippetWithTitle_rev(tia.toolTip), jscroll(withMargin(wordWrapTypeWriterTextArea(text))), frame);
25  
        }
26  
      });
27  
  }
28  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1015337
Snippet name: Display snippet source on hover action
Eternal ID of this version: #1015337/24
Text MD5: 5b917425751060991be2dc7a759db9f2
Transpilation MD5: f2dea5e4d575a20547573216671c53a2
Author: stefan
Category: javax / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-17 13:57:33
Source code size: 888 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 503 / 1329
Version history: 23 change(s)
Referenced in: [show references]