static Component selectSubdirOrCreateNew(File motherDir, final VF1 action) { JList list = jlist(map f2s(listDirs(motherDir))); onDoubleClickOrEnter(list, voidfunc(S path) { callFInNewThread(action, newFile(path)); disposePIFrame(list); }); JButton okButton = listDependentButton(list, "OK", r { callFInNewThread(action, newFile(selectedItem(list))); disposePIFrame(list); }); ret showFrame_returnContents("Choose a directory", centerAndSouthWithMargins( withTitle("Please select a directory or create one", list), westAndEast(okButton, jbutton("Create directory...", r { inputText("Name of new directory", voidfunc(S name) { File f = mkdirs(newFile(motherDir, name)); fillListWithStrings(list, map f2s(listDirs(motherDir))); selectItem(list, f2s(f)); focusComponent(okButton); }); })))); }