srecord noeq JOnDemandWithReloadButton(IF0 makeComponent) is Swingable { SingleComponentPanel scp = singleComponentPanel(); ReliableSingleThread rstReload = rst(l0 reloadImpl); JButton btnReload; settable JPanel controls = rightAlignedLine(); SingleComponentPanel scpControlsMain = scp(); settable bool loadingScreenWhenReloading; void reload { rstReload.trigger(); } cachedVisualize { makeControls(); bindToComponent(scp, -> { if (scp.isEmpty()) reload(); }, null); ret northAndCenter(withMargin(centerAndEastWithMargin(scpControlsMain, controls)), scp); } void makeControls { btnReload = jReloadButton(l0 reload); controls.add(btnReload); } 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))); } } }