Transpiled version (13444L) is out of date.
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; } }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034207 |
Snippet name: | JFilePathLabel - JLabel showing file path and allowing to open in file exporer |
Eternal ID of this version: | #1034207/24 |
Text MD5: | b42a46299c6aa15b2e73747f30161045 |
Author: | stefan |
Category: | javax / screen recognition |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-01 22:16:27 |
Source code size: | 1211 bytes / 46 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 203 / 433 |
Version history: | 23 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) #1034438 - JFilePathButton - JButton with a small icon allowing to open a file in file exporer #1035150 - JSelectableDirLabel |