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

61
LINES

< > BotCompany Repo | #1020090 // Multi-Line Java Eval w/baby symbols [Evaluate Java Code, Dyn Module, one baby per submodule made :)]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 108K of libraries. Compilation Failed (20060L/148K).

1  
!7
2  
3  
set flag DynModule. // for transpilation
4  
set flag NoSwitchableFields.
5  
6  
sclass JavaEval extends DynPrintLog {
7  
  S expression;
8  
  bool realEval = true;
9  
  transient bool calculating;
10  
  transient O value;
11  
  transient JTextArea taInput;
12  
  transient Throwable error;
13  
  transient JPanel babiesPanel;
14  
15  
  start {
16  
    loadImage2(#1101447);
17  
    makeDependent_postProcess = r updateBabySymbols;
18  
    dm_vmBus_onMessage('gcDone, r updateBabySymbols);
19  
    doEvery(300.0, r updateBabySymbols); // just to be sure to updat eit sometimes
20  
  }
21  
22  
  visualize {
23  
    ret centerAndSouthWithMargins(
24  
      jvsplit( 
25  
        centerAndEastWithMarginInbetween(
26  
          onCtrlEnter(taInput = jEnableUndoRedo(typeWriterTextArea(expression)), rThread evalIt),
27  
          vstackWithSpacing(
28  
            jbutton("Fresh", rThread { refresh(); evalIt() }),
29  
            jbutton("Eval", rThread evalIt),
30  
            withToolTip("Don't interpret", dm_fieldCheckBox("Real", 'realEval)))),
31  
        super.visualize()),
32  
        jScrollWithoutBorder(babiesPanel = leftAlignedLine()));
33  
  }
34  
  
35  
  void refresh {
36  
    call(dm_transpiler(), 'refresh);
37  
    loadFunctions_clearCache();
38  
    print("Refreshed translator.");
39  
  }
40  
  
41  
  void evalIt {
42  
    if (calculating) ret;
43  
    calculating = true;
44  
    temp afterwards(r { calculating = false });
45  
    dm_javaEvalModule_doIt(gtt(taInput), realEval);
46  
  }
47  
  
48  
  void updateBabySymbols enter {
49  
    dm_q().add(r {
50  
      final int n = l(dependentClasses());
51  
      final BufferedImage img = scaleImageToWidth(loadImage2(#1101447), 24);
52  
      swing {
53  
        removeAllComponents(babiesPanel);
54  
        repeat n {
55  
          babiesPanel.add(toolTip("You have made one cute little subprocess!", jimage(img)));
56  
        }
57  
        revalidate(babiesPanel);
58  
      }
59  
    });
60  
  }
61  
}

Author comment

Began life as a copy of #1017551

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020090
Snippet name: Multi-Line Java Eval w/baby symbols [Evaluate Java Code, Dyn Module, one baby per submodule made :)]
Eternal ID of this version: #1020090/18
Text MD5: 2a07f6216b26f0897deac86272d92bca
Transpilation MD5: 6d9dfe2d61957f2fcc9e25e82474df76
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-14 01:05:45
Source code size: 1819 bytes / 61 lines
Pitched / IR pitched: No / No
Views / Downloads: 336 / 1388
Version history: 17 change(s)
Referenced in: [show references]