sclass G22AnalysisPanel > MetaWithChangeListeners is Swingable, AutoCloseable { // This is actually persistable // TODO: use Ref pointer so it's cleaned when target is deleted settableWithVar G22Recognizer analyzer; transient settable G22Utils g22utils; transient SingleComponentPanel scp; transient ReliableSingleThread rstStartAnalysis = new(r _startAnalysis); transient gettable BufferedImage image; transient G22RunSingleAnalyzerPanel analyzerPanel; // we may be getting the same instance again but it still means // there was a change in the image public void setImage(BufferedImage image) { this.image = image; analyzerPanel?.setImage(image); } cachedVisualize { scp = singleComponentPanel(); varAnalyzer().onChangeAndNow(rstStartAnalysis); ret northAndCenterWithMargins( withLabel("Analyzer", bindComboBoxToVar(varAnalyzer(), jTypedComboBox(nullPlus(list(g22utils.concepts(), G22Recognizer)), analyzer))), scp ); } void _startAnalysis { var panel = optCast G22RunSingleAnalyzerPanel(analyzerPanel); if (panel == null || panel.analyzer != analyzer) scp.set(analyzerPanel = new G22RunSingleAnalyzerPanel(g22utils, image, analyzer)); } close {} }