I need a nautilus-style file picker in java, where the files are shown "gallery-style" with a customisable thumbnail for each file. Is it possible to make the standard open file dialog do this? If not, does anyone know of an open-sourced widget that I can use?
The JFileChooser
allows you access to a custom area where you can add whatever UI elements you'd like. It's available via setAccessory(JComponent)
as documented in the javadoc.
I want one callback per file to display its thumbnail preview as its icon.
I think @davetron5000 suggestion may still be useful: As shown in How to Use File Choosers, the FileChooserDemo2 example demonstrates an approach to constructing thumnails. It's not exactly what you're looking for, but it may be a good starting point. You'd update your preview pane in response to DIRECTORY_CHANGED_PROPERTY
, rather than SELECTED_FILE_CHANGED_PROPERTY
.
Addendum: org.netbeans.swing.outline.Outline
with a custom TableCellRenderer
might be an interesting alternative.
I suppose nautilus is the KDE file manager.
I don't no if that is available for KDE, but for Windows i usally use the (Eclipse) SWT file chooser, because it is more native than the pure Swing implementation.