srecord noeq JFilePathLabel(File file) is Swingable { transient JLabel label; transient JFilePathButton button; transient JPanel buttons = jline(); bool nameOnly; settable bool iconOnTheLeft; settable bool minWidth; // allow file path to be shortened if layout requires it cachedVisualize { label = jlabel(); if (minWidth) jnarrowLabel(label); makeButtons(); update(); ret layout(); } void makeButtons { button = new JFilePathButton(file); buttons.add(button.visualize()); } void setFile(File file) { this.file = file; update(); } File file aka get() { ret file; } void update { setText(label, file == null ? "-" : nameOnly ? fileName(file) : f2s(file)); if (nameOnly) toolTip(file == null ? "No file" : f2s(file), label); button.setFile(file); } JComponent layout() { var a = buttons; var b = label; ret iconOnTheLeft ? minWidth ? westAndCenterWithMargin(a, b) : jline(a, b) : minWidth ? centerAndEastWithMargin(b, a) : jline(b, a); } void showInExplorer { button.showInExplorer(); } selfType nameOnly() { set nameOnly; this; } }