abstract sclass CollectIOExamples > DynModule { new L<Example> examples; transient JList examplesList; srecord Example(S question, S answer) { toString { ret question + " -> " + answer; } } JComponent visualize() { ret withCenteredButtons(listPopupMenuThreaded(examplesList = jLiveValueList(dm_fieldLiveValue('examples)), "Delete Example", voidfunc(S row) { temp enter(); setField(examples := listMinusToString(examples, row)) }), buttons()); } O[] buttons() { ret litobjectarray("Add example...", rThread addExampleDialog); } void addExampleDialog { final JTextField tfQuestion = jtextfield(), tfAnswer = jtextfield("?"); showFormTitled("Add example", "Question:", tfQuestion, "Answer (if known):", tfAnswer, r { temp enter(); setField(examples := listPlus(examples, new Example(gtt(tfQuestion), gtt(tfAnswer)))); }); } }
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: | #1016854 |
| Snippet name: | CollectIOExamples [Include] |
| Eternal ID of this version: | #1016854/5 |
| Text MD5: | 3ee9634f769e7309534c3f7f20cf468b |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-11-24 04:16:47 |
| Source code size: | 910 bytes / 23 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 616 / 1186 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |