Skip to content

Fix Copy+Paste and Drag&Drop in SwingFileWidget: - #92

Open
tferr wants to merge 1 commit into
scijava:mainfrom
tferr:file-widget-fix
Open

tferr wants to merge 1 commit into
scijava:mainfrom
tferr:file-widget-fix

Conversation

@tferr

@tferr tferr commented Oct 21, 2026

Copy link
Copy Markdown
Contributor
  • Copy and paste of file paths was broken on Linux, macOS, and Windows
  • Drag and drop of files from the OS was broken on macOS

This fixes both using a similar approach to what is used in SNT, and adds extra improvements

  • Add a clear button to all text fields
  • Add a placeholder text to empty fields of SwingFileWidget with the 3 ways to populate it
  • Animate fields with FlatLaf's outline error border when an invalid file is dropped (These use FlatLaf's client properties, so they are safe if some other L&F is being used)

Manually tested on macOS 27, Ubuntu 26.04, and Windows 11: ffter the patch: copy/paste and drag and drop work on all 3, no issues found. (well, stress-testing a drop of dozens of files stalled Explorer on Windows. The old code behaved the same, so it is not addressed here 😢 )

This is how the fields look like with the FlatLaf additions:

ScreenShot 2026-10-21 at 12 34 57 

- Copy and paste of file paths was broken on  Linux, macOS, and Windows
- Drag and drop of files from the OS was broken on macOS

This fixes both using a similar approach to what is used in SNT, and adds extra improvements
- Add a clear button to all text fields
- Add a placeholder text to empty fields of SwingFileWidget with the 3 ways to populate it
- Animate fields with FlatLaf's outline error border when an invalid file is dropped
(These use FlatLaf's client properties, so they are safe if some other L&F is being used)

Tested on macOS 27, Ubuntu 26.04, and Windows 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant