Results 1 to 2 of 2
- 01-07-2013, 03:48 PM #1Member
- Join Date
- Sep 2012
- Rep Power
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?
- 01-07-2013, 04:15 PM #2
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.
- By kastraki2000 in forum Java AppletsReplies: 2Last Post: 04-30-2011, 03:56 PM
- By j2me64 in forum Java 2DReplies: 3Last Post: 04-24-2010, 04:57 PM
- By Suurisa in forum New To JavaReplies: 2Last Post: 10-27-2009, 01:52 AM
- By sfaxianovic in forum New To JavaReplies: 2Last Post: 08-21-2008, 03:30 AM
- By Aswq in forum New To JavaReplies: 12Last Post: 07-18-2008, 08:10 AM