title: Finding the Tile from a MouseListener
body: <p>I'm trying to make a chess game utilizing the <code>MouseListener</code> <code>interface</code>. (No JButtons!)
  After a click, I am able to find the <code>[x, y]</code> location of the click on the <code>JFrame</code>, but I want to find the tile.</p>
  
  <p>The chess board is an <code>8 x 8</code> grid. A tile is a location on that grid (So <code>[1, 3]</code> is a tile.)</p>
  
  <p>My thought is to divide the <code>xPosition</code> by the <code>tileWidth</code>, and the <code>yPosition</code> by the <code>tileHeight</code>. I should be able to find the <code>tileHeight</code> and <code>tileWidth</code> by getting the size of the screen and divide it by the number of tiles (Which will always be <code>8</code>, because a chess board is <code>8 x 8</code>) </p>
  
  <p>This works for the most part, but as I click closer to the edges of each tile, the result for the equation above is inaccurate. </p>
  
  <pre class="lang-java prettyprint-override"><code>/** 
   * @param screen The JPanel that contains the tiles (Will always be the size of the entire board)
   * @param pos The (x, y) position of the click
   * @return The tile found from the click
   */
  public Tile getTile(Screen screen, Pos pos) {
  
      int x = (pos.x / (screen.getWidth() / Board.WIDTH)); // When trying to typecast to a double, then back to an int, the result become more inaccurate.
      int y = (pos.y / (screen.getHeight() / Board.HEIGHT));
      System.out.println(new Pos(x, y));
  
      return tiles[y][x];
  }
  </code></pre>
  
  <p>EDIT: My <code>JPanel</code> is the same size as the <code>JContentPane</code> (Area in the JFrame)</p>