!7 cmodule PieceDatabase { S piece = "white king"; transient MultiMap multiMap; transient SingleComponentPanel scp; transient ImageSurface is; transient JLabel lblCount; transient ReliableSingleThread rst = dm_rst(module(), r update); start-thread { multiMap = pairsToCIMultiMap(chessOCR_squareImagesCollectorFromAGIBlue().allImages()); rst.trigger(); } void update { if (multiMap == null || is == null) ret; scp.setComponent(centerAndSouthWithMargin(jScroll_center(is), lblCount)); L images = multiMap.get(replaceObject(piece, "empty square", "empty")); is.setImage(mergeBufferedImagesHorizontally(images)); setText(lblCount, nImages(images)); } visualize { is = jImageSurface(); lblCount = jCenteredLabel(); ret withComputing(rst, northAndCenterWithMargins( withLabel("Show images for:", main.onChange(rst, dm_comboBox piece(replace(ai_chessPieces(), "empty", "empty square")))), scp = singleComponentPanel(jCenteredLabel("Loading...")))); } }