How to drag and drop a JPanel to another JPanel?

Is it better to use native drag and drop API or library?

  • I planed to design a game and it needs drag and drop. I have been experimenting with the native (HTML5) drag and drop API and (from 3-4 hours experimenting) it feels very limited in what it can do (or at least hard for me to get my head around) This came is something that I used to play as a kid and have not found any online version. So it is a fun personal project but one that I want to be able to brag about on my portfolio, so should I stick with the native API or find a drag and drop js library

  • Answer:

    I always opt for library... Knowing someone dealt with all the edge cases (think 6+ browsers) is very comforting to reduce the "oh shit" moments that come from your clients using ie7. If you think you want to deal with it all, please contribute back after a few revisions to help others who may not want to deal with it. I've started multiple open source projects when i didnt find a  good enough solution. It's all about karma.

Angel Grablev at Quora Visit the source

Was this solution helpful to you?

Other answers

I have the total opposite opinion as angel :) I only use libraries where they are really necessary to keep things clean (e.g. pushState router). However else I avoid using libraries as possible. I am not interested in compability and I disagree with some frameworks hiding a lot up (like Backbone, jQuery, Ember) and forcing you into an environment. At least in JavaScript it is really easy just to use single components and structure them together how you want. Want to change the template engine? Just update the package and update the render calls to the new lib. So back to the main question: No, I would not use a library as I am not interested in backwards compability. However if my app would take a huge use of for example the File API I would choose a small library to reduce overhead and code. var drop = require('drop'); var el = document.querySelector('#drop'); drop(el, function(e){    var items = e.items;       items.forEach(function(item){             console.log(item);   }); }); Source: https://github.com/component/drop

Bodo Kaiser

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.