I want to add tooltip on the certain text in jtextpane. Can anyone show me how to do this. For example I want to add the location of text on which it is present in string in tooltip. When the user hover the mouse on that area it will show the location of text. I had search the problem but I have found that I had to override gettooltip method. I do not how to do this.
In pseudo code
1) getToolTipText(MouseEvent event)
2) Using the event object, figure out the x,y coordinates
3) Using the co-ordinates figure out which part of the text the mouse is hovering over
4) Provide relevant text based on the text