title: Get position/index of a JPanel in a GridLayout?
body: <p>I'm trying to follow MVC-design and currently creating a MouseAdapter in my Controller class. I have an array the same size as the GridLayout in one of my model classes.
  So when someone clicks a JPanel somewhere in the grid, I'd the MouseAdapter to notify the model and do something. The JPanels are in another class, View.</p>
  
  <p>But for that I need the index/position of that particular JPanel, is there some way to get it?</p>
  
  <p>I checked out the GetX and GetY methods of MouseEvent which state:</p>
  
  <p>GetX -  Returns the horizontal x position of the event relative to the source component. </p>
  
  <p>Get Y - Returns the vertical y position of the event relative to the source component. </p>
  
  <p>Relative to the source component, does that mean that the upper left corner of the JPanel is 0, 0? How then do I know which of the panels in the GridLayout was clicked?</p>