title: How to save the location of a component that has been previously clicked on on a GridLayout
body: <p>I'm making a little game in java called ColorLine </p>
  
  <p>(the game : <a href="http://www.gamesforthebrain.com/french/colorlines/" rel="nofollow noreferrer">http://www.gamesforthebrain.com/french/colorlines/</a> )</p>
  
  <p>so I made a JFrame and added to it a gridLayout of JPanels (two dimensions array) and the pieces are represented by JButtons which are added to the JPanels. and I want to move the JButtons from a panel to another using mouseClicked method in MouseInputListener interface, by clicking on the button, then clicking on the empty panel (destination) but I have no idea how to save the location of the the button that has been clicked first especially how to transform the location into x, y coordinates in order to use them for my two dimensions array of Jpanels
  thanks :)   </p>