!7 sS background = #1009931; static JDesktopPane desktop; static JTextField tfInput; static L modules = synchroList(); p-noconsole { autoRestart(5); desktop = jTiledBackgroundDesktopPane(background); autoFixDesktopPane(desktop); cleanExitOnFrameClose(showMaximizedFrame(desktop)); final JInternalFrame f = showCenteredInternalFrame(desktop, "Hello", 700, 150, setFontSize(20, tfInput = jcenteredtextfield("Find me some stuff"))); packInternalFrameVertically(f); centerInternalFrame(f); swing { f.setLocation(f.getX(), 40); } } sbool hasModuleWithFields(Class c, O... params) { ret hasWhere(modules, c, params); } svoid startModule(Module m) { addIfNotThere(modules, m); lock m.lock; if (m.started) ret; m.started = true; m.start(); } svoid showModule(final Module m) { startModule(m); lock m.lock; if (m.vis == null) m.vis = m.visualize(); swing { Rect r = randomRect(desktop.getWidth(), desktop.getHeight(), 10, 150, 50); if (r == null) r = Rect(10, 10, 200, 100); showInternalFrame(desktop, shortClassName(m), r.x, r.y, r.w, r.h, m.vis); } } sclass Module { Component vis; bool started; Lock lock; JComponent visualize() { ret jCenteredMultiLineLabel(sfu(this)); } void start() {} void cleanMeUp() {} } sclass InterestingStringModule extends Module { S theString; } sclass InputToInterestingString extends Module { transient java.util.Timer timer; void start { timer = doEvery(1000, r { S s = getTextTrim(tfInput); if (!hasModuleWithFields(InterestingStringModule, theString := s)) startModule(nu(InterestingStringModule, theString := s)); }); } void cleanMeUp() { cancelTimer(timer); } }