views:

66

answers:

1

Hello.

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.

+4  A: 

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.

Ham
Thank you for your answer! Although I'm also wondering if SWT did implement some form of drag and drop different from Java has provide? Is it easier to work with?
Kenston
Java itself has not a general drag and drop-support. Drag and drop is implemented as part of AWT. SWT uses its own drag and drop implementation.
Ham