sclass JContentAndControls is Swingable, Updateable { settable IF0/**/ makeContent; SingleComponentPanel scpContent = singleComponentPanel(); ReliableSingleThread rstReloadContent = rst(l0 reloadImpl); settable JButton btnReload; gettable DynamicHStack controls = dynamicHStack(); SingleComponentPanel scpControls = singleComponentPanel(jfullcenter(controlscontrols)); SingleComponentPanel scpBigControl = scp(); settable bool loadingScreenWhenReloading; settable bool showControls = true; public void reload aka update() { rstReloadContent.trigger(); } cachedVisualize { onComponentShown(scpContent, -> { if (scpContent.isEmpty()) reload(); }); if (!showControls) ret scpContent; makeControls(); ret northAndCenter( centerAndEastWithMargins( centerAndEastWithMargin(scpBigControl, scpControls), btnReload), scpContent); } void makeControls { if (!showControls) ret; btnReload = jReloadButton(l0 reload); controls.add(btnReload); } swappable JComponent makeLoadingScreen() { ret jCenteredLabel("Loading..."); } void reloadImpl { temp tempDisableButton(btnReload); if (loadingScreenWhenReloading() || !scpContent.hasComponent()) scpContent.set(makeLoadingScreen()); try { scpContent.set(wrap(makeContent?!)); } catch print e { scpContent.set(jErrorView(e)); } } selfType setBigControl(JComponent etc bigControl) { scpBigControl.set(bigControl); this; } selfType addControl(S label, JComponent etc control) { ret addControl(withLabel(label, control)); } selfType addControl(JComponent etc control) { controls.addComponent(control); this; } selfType content(IF0 makeContent) { ret makeContent(makeContent); } selfType addControlLine(JComponent newControls) { scpControls.set(centerAndSouthWithMargin(scpControls!, newControls); this; } }