!7 static DynamicVStack buttons; static Set loadedButtons /*= new HashSet; */ = weakIdentityHashSet(); static Q loadQ; set flag WeakIdentityHashMap_debug. p-subst-autoupdate { buttons = showNiceVerticalButtons(); refresh(); addButtonsToWindow(buttons, "Refresh", f-thread refresh); } svoid refresh { if (replaceNiceButtons(buttons, filesForNiceButtons(sortFilesByDate(listPNGFiles(userDesktopDir()))))) { centerPackFrame(buttons); scrollPaneOnScroll(enclosingScrollPane(buttons), r { for (final JButton b : (L) (L) stackElementsShowing(buttons)) { if (add(loadedButtons, b)) pcall { // will strangely not work? //if (add_byContains(loadedButtons, b)) pcall { TextImageAction tia = makeNiceButtons_map.get(b); if (tia == null) continue with print("no tia"); final File f = filesForNiceButtons_map.get(tia); if (f == null) continue with print("no file"); if (loadQ == null) loadQ = startQ(); loadQ.add(r { setButtonImage(b, loadPreviewImageWithExactHeight(128, f)); print("Loaded: " + f); print("Size: " + l(loadedButtons)); }); } } }); } }