0

basically i want to create the same machanic used in hearthstone. you press a card, drag it to the playing field and release, causing an event to trigger. ive been searching for tutorials for a while now and cant seem to figure it out. im trying to accomplish this with MouseListener and MouseMotionListener. If anyone can just give me a tiny snippet of how you would write the code for the methods mousePressed, mouseDragged and mouseReleased say from one JPanel to another I would greatly appreciate. thanks.

  • 1
    Swing provides this feature. Tutorial https://docs.oracle.com/javase/tutorial/uiswing/dnd/intro.html – Jay Smith Jul 05 '17 at 04:58
  • I'd consider looking the low level drag and drop API – MadProgrammer Jul 05 '17 at 04:59
  • 2
    [For example](https://stackoverflow.com/questions/16478413/move-component-after-drag-and-drop/16481711#16481711), [example](https://stackoverflow.com/questions/11201734/java-how-to-drag-and-drop-jpanel-with-its-components/11443501#11443501), [example](https://stackoverflow.com/questions/13855184/drag-and-drop-custom-object-from-jlist-into-jlabel/13856193#13856193), [example](https://stackoverflow.com/questions/28844574/drag-and-drop-from-jbutton-to-jcomponent-in-java/28844969#28844969), [example](https://stackoverflow.com/questions/15520610/java-drag-and-drop/15521421#15521421) – MadProgrammer Jul 05 '17 at 05:02

0 Answers0