JTextPane , MouseListener on certain words.
I have an jTextPane wich displays search results from a database. I Would like to make certain words active to a MouseListener , i have done some searches but i am afraid that it is only possible to make the whole JTextPane do the same thing with MouseListener.
Would it be possible to have certain words do certain things?
Re: JTextPane , MouseListener on certain words.
There's probably better ways to do it, but one option would be to add the MouseListener to your JTextPane as you said, and inside of your mouseReleased() method, call getSelectedText() on the JTextPane, and if the returned value is the String you are interested in, perform your action.