srecord noeq JOnDemandWithReloadButton(IF0 makeComponent) is Swingable { SingleComponentPanel scp = singleComponentPanel(); ReliableSingleThread rstReload = rst(l0 reloadImpl); JButton btnReload; JPanel controls = rightAlignedLine(); settable bool loadingScreenWhenReloading; void reload { rstReload.trigger(); } cachedVisualize { btnReload = jReloadButton(l0 reload); bindToComponent(scp, -> { if (scp.isEmpty()) reload(); }, null); controls.add(btnReload); ret northAndCenter(withMargin(controls), scp); } void reloadImpl { temp tempDisableButton(btnReload); if (loadingScreenWhenReloading() || !scp.hasComponent()) scp.setComponent(jCenteredLabel("Loading...")); try { scp.setComponent(makeComponent?!); } catch print e { scp.setComponent(jscroll(jFastLogView_noWrap(renderStackTrace(e))); } } }