0

Ok so I set up a method that takes the mousePressed argument and gets its point relative to the grid layout, and I want it to know that when I mouseRelease ( drop it ) it drops it in mouseRelease's targeted component but instead when I test it out it just says that I'm pressing and releasing on the same spot

Does mouseRelease and mousePressed not work the way I think it does? What should I do? Sorry I don't have pictures I'm on my phone rn lol

Frakcool
  • 10,915
  • 9
  • 50
  • 89
  • 1
    Welcome to Stack Overflow, please take the [tour] and go through the [help], then learn [ask] and come back with a valid [mcve] or [Short, Self Contained, Correct Example](http://sscce.org/) that demonstrates your issue – Frakcool Jan 26 '17 at 19:59
  • MouseEvents are relative to the component that you add the MouseListener to. Check out this [Chess Board Example](http://stackoverflow.com/questions/22343047/asking-for-some-clarification-in-java-about-jlabel-and-parent/22357889#22357889) for a way to move an Icon from one square to another in a grid. – camickr Jan 26 '17 at 20:30
  • [One way](http://stackoverflow.com/questions/13698217/how-to-make-draggable-components-with-imageicon/13700490#13700490), [another way](http://stackoverflow.com/questions/11201734/java-how-to-drag-and-drop-jpanel-with-its-components/11443501#11443501), [another way](http://stackoverflow.com/questions/26599600/dragging-and-dropping-to-move-a-jtextarea-around-on-jpanel/26600026#26600026) – MadProgrammer Jan 26 '17 at 20:50

0 Answers0