Hi Manfred,
Thanks a lot for the help. But, it is not working like expected. I mean, irrespective of where the mouse is placed on the editorpane, it just selects the first few lines of the html text in the editorpane. I didn't mention this before but I am loading a html file into editorpane dynamically(using the JEditorPane contructor, editorPane = new JEditorPane(url); and the url being like
http://www.rbi.com). Thus, the firstIndex is always -1(the first character in the html text) and depending on the length of the str, the lastIndex is calculated. The str selected, from the editorPane using AccessibleContext and AccessibleText, is correct although the firstIndex is wrong. I hope you can still help me with this problem. Thank You.
Padma