This would be better if there was more information however i going to make the following assumptions:
- Your tiles are based off a 2d grid (from: slick2d and array)
- your using doubles to store position (cast if not true)
First of to find the tile you clicked on you would as you
say divide your mouse position to your tile position so
double mousetileX = Math.floor(mousex/tileWidth);
double mousetileY = Math.floor(mousey/tileHeight);
you may need to take into account your view port offset if the map bigger than screen.
Now you have your click co-ordinates and you will already know your position co-ordinates there is a way to get the distance to them namely Pythagoras theorem
Basically states that on a right angle triangle the length of the hypotenuse (the longest side) is the square root of the sum of the squares of the other two sides. Wait a minute we dont have a triangle... sure we do.
If you draw a line between your coords then and then two more lines from that to meet at a 90 degree angle there it is.
To do this programmatically we first find the length of our first side.
double lengthx = Math.abs(positionx-mousetileX); //abs to ensure positive.
double lengthy = Math.abs(positiony-mousetiley);
now we simply follow the formula
double distance = Math.sqrt((lengthx*lengthx)+(lengthy*lengthy));
And distance will be the length of the longest side ie your distance between your tiles.
Almost forgot what i have shown how to calculate is the relative distance between tiles on your grid not taking into account the tileWidth height to allow them to dynamically be resized etc.
Also when calculating player position relative to your grid it is pretty similar to
the mouse calculation.
double playertileX = Math.floor(playerx/tileWidth);
double playertileY = Math.floor(playery/tileHeight);
Hope this helps