Sunday, January 20, 2013

Native Drag & Drop with JavaFX

Usability is king. Enable your applications with drag and drop support to make your users happy.

JavaFX supports Drag and Drop - I've added some rudimentary DnD support for the tree visualisation program. The code for the whole project is available at github.

The relevant code parts are those here:

basic Drag and Drop Support with JavaFX 

I use the ShapeConverter class to convert the javafx based trees to a svg format - you'll find more valuable gadgets like this in the jfxtras project.

On MacOsX this code can drop directly into the browser, but not on the desktop for example. Under Windows7 it works however. Have a look at the jira for a list of open DnD JavaFX issues. (login required)

This is just a starting point for drag and drop, you can register even more listeners to make your application more user friendly - see the tutorial here.

No comments:

Post a Comment