// Note: renderUIUrl etc are called in Swing thread srecord noeq UIURLSystem(Enterable owner, SimpleLiveValue uiURL) { // key: ui URL transient Map uiMap = syncCIMap(); sclass Entry { S url; S toolTip; IF0 makeComponent; *(S *url, IF0 *makeComponent) {} *(S *url, S *toolTip, IF0 *makeComponent) {} } settable transient SingleComponentPanel scp; JComboBox comboBox; JComponent urlBar() { comboBox = autoComboBox(url(), cloneKeys(uiMap)); centerComboBox(comboBox); comboBoxDynamicToolTip(comboBox, entry -> entry.toolTip); ret withLabel("Show", comboBoxAndButton( onSelectedItem( bindComboBoxToLiveValue(comboBox, uiURL), url -> showUIURL(url) ), "Go", url -> showUIURL(url))); } JComponent renderUIUrl aka renderUIURL aka uiGet(S url) { try { temp tempEnter(owner); var entry = uiMap.get(url); if (entry == null) ret jCenteredLabel("URL not found: " + url); var component = entry.makeComponent!; ret component; } catch print e { ret jErrorView(e); } } void showUIURL(S url) { temp tempEnter(owner); setURL(trim(url)); go(); } void go { setComponent(scp, renderUIUrl(url())); } S url() { ret uiURL!; } void setURL(S url) { uiURL.set(url); } selfType put(S url, S toolTip default null, IF0 maker) { uiMap.put(url, new Entry(url, toolTip, maker)); this; } }