Libraryless. Compilation Failed (13795L/81K).
1 | srecord noeq JFilePathButton(File file) is Swingable { |
2 | transient JButton button; |
3 | |
4 | cachedVisualize { |
5 | if (button == null) { |
6 | button = jimageButtonScaledToWidth(16, #1101292, "", l0 showInExplorer); |
7 | componentPopupMenuItem(button, "Copy path", -> copyToClipboard(f2s(file))); |
8 | } |
9 | updateToolTip(); |
10 | ret button; |
11 | } |
12 | |
13 | void showInExplorer { |
14 | thread { |
15 | File dirToShow = isFile(file) ? dirOfFile(file) : file; |
16 | //startPlatformFileManager(dirToShow); |
17 | desktopOpen(dirToShow); |
18 | } |
19 | } |
20 | |
21 | void setFile(File file) { |
22 | this.file = file; |
23 | updateToolTip(); |
24 | } |
25 | |
26 | void updateToolTip { |
27 | setEnabled(button, file != null); |
28 | toolTip(file == null ? "No file" : f2s(file) + " [click to show in file explorer]", button); |
29 | } |
30 | } |
Began life as a copy of #1034207
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, ekrmjmnbrukm, elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034438 |
Snippet name: | JFilePathButton - JButton with a small icon allowing to open a file in file exporer |
Eternal ID of this version: | #1034438/7 |
Text MD5: | 34d3602a311d7315232a23dabfeb6aee |
Transpilation MD5: | 1c20df8286fefc0f4c5a708a7b26d4cb |
Author: | stefan |
Category: | javax / screen recognition |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-01-15 19:19:39 |
Source code size: | 800 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 182 / 302 |
Version history: | 6 change(s) |
Referenced in: | [show references] |