javaaliceblock-programming

Are there Java libraries to do drag and drop


Are there open source libraries for Java to make implementation of drag and drop easier?

I plan to make something like the one shown below:

alt text

The program is Alice, where you can drag some elements on the left and nest them to the right. It's open source, but they did not use any libraries I think. I'm wondering if we anyone know of open source frameworks that work this way, or assist in doing complex drag and drops.


Solution

  • If you use Swing I recommend working with the AWT internal drag and drop system.

    As Sun mentions on their guides:

    We do not recommend that you create your own drag and drop support using the AWT classes. This implementation would require significant complex support internal to each component.
    [source]

    For a deeper look at swing dnd you should try the Drag and Drop-Guide.

    If you decide to use a different toolkit than Swing you could be successfull finding any good third party drag and drop libraries.