Uses 3874K of libraries. Click here for Pure Java version (9012L/62K/198K).
1 | !7 |
2 | |
3 | sS text1, text2; |
4 | static JTextArea a, b, d; |
5 | static JCheckBox trim; |
6 | static JFrame frame; |
7 | |
8 | p-awt { |
9 | // change to pretty L&F if we're the main program |
10 | if (isMainProgram()) substance(); |
11 | |
12 | frame = showFrame(centerAndSouth(hgrid( |
13 | withTitle("Text A (-)", a = new JTextArea(text1)), |
14 | withTitle("Diff", withMargin(wrap(d = new JTextArea))), |
15 | withTitle("Text B (+)", b = new JTextArea(text2))), |
16 | centeredLine(trim = new JCheckBox("Ignore Indent", true)))); |
17 | trim.setToolTipText("Also ignores empty lines"); |
18 | setFrameWidth(frame, 800); |
19 | |
20 | update(); |
21 | onUpdate(ll(a, b, trim), "update"); |
22 | } |
23 | |
24 | svoid update { |
25 | d.setText(unidiff(preprocess(a.getText()), preprocess(b.getText()))); |
26 | } |
27 | |
28 | sS preprocess(S s) { |
29 | if (isChecked(trim)) |
30 | s = fullTrim(s); |
31 | ret s; |
32 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1004311 |
Snippet name: | Graphical Diff [Swing Frame with two texts and diff] |
Eternal ID of this version: | #1004311/5 |
Text MD5: | 848d1c88fce4b28b4bd0ffe7369f58a6 |
Transpilation MD5: | 55e308b0b09c070e99a22b49de244a70 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-10-19 16:38:13 |
Source code size: | 803 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 654 / 1149 |
Version history: | 4 change(s) |
Referenced in: | [show references] |