This bean was made by request, but is released as Open Source (FreeBSD License), it is compatible with Servoy developer, smart client but NOT web client.

It works in Servoy 5.x, 4.1.x and Servoy 3.5.x for Windows and Mac OS X and should work well with Linux OSes as well (not tested).

The idea is that this bean, when visible, adds a "drop target" surface on your form, when not visible, it transforms the whole form's background surface (and disabled/non editable objects) into a drop target for files.

When visible, it is a JList of files and will have all the behavior you would expect from a JList: you can select multiple lines, and I have added the option to omit the selection (by right-click popupmenu or using the backspace, delete or "-" keys) .

New with v1.1, there is an accept property which will take a list of extensions accepted (separated by ',' ';' or space).

You can attach 2 JavaScript callback methods to events:

  • onDrop will be called when files are dropped to it and will return an array of java.io.File (conveniently the .toString() methods of a file returns the path),
  • onOmit will be called when files are omitted (with a right-click from the mouse or one of the delete keys), it will return an array of 2 arrays of java.io.File (omitted files, and remaining files).

You can drop files from your Windows explorer or Mac finder, you can even drop them from Eclipse or some other explorer that holds a tree of files basically (not Outlook though, as someone asked me).

The recurseFolders flag also tells the bean to recursively retrieve all the files containers inside a folder (or folders) dropped on it.
If true, you will get all the files in a folder, if false, you will only get the folder itself.