sclass JControlsAndContent is Swingable { settable IF0 makeContent; SingleComponentPanel scpContent = singleComponentPanel(); ReliableSingleThread rstReloadContent = rst(l0 reloadImpl); settable JButton btnReload; SingleComponentPanel scpControls = singleComponentPanel(); gettable JPanel controls = rightAlignedLine(); SingleComponentPanel scpBigControl = scp(); settable bool loadingScreenWhenReloading; settable bool showControls = true; void reload { rstReloadContent.trigger(); } cachedVisualize { onComponentShown(scpContent, -> { if (scpContent.isEmpty()) reload(); }, null); if (!showControls) ret scpContent; makeControls(); ret northAndCenter( centerAndEastWithMargins( centerAndEastWithMargin(scpControlsMain, controls), 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(makeComponent?!); } catch print e { scpContent.set(jErrorView(e)); } } }