In that example the co-ordinates are being calculated..but my requirement is,i have to get both the co-ordinates and have to set tooltip which displays the value when pointing on that co-ordinate
I don't understand what this means. From where are you getting the coordinates?
If you're talking of detecting where the mouse points to, then you need to add a MouseMotionListener. It supplies the code with MouseEvents, which have the X/Y information where the mouse is.
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades: