Clickable text in JTextPane

Hi,

I'm displaying a list of results in a JTextpane and attached to each on eof this results is a number which is used to edit that particular result. In order to edit the results at the moment, I need to enter the number in a textfield and then click a button in order to load its details.

I would like to know if I can possibly make these numbers "clickable" so that, if one clicks on it, the results which can be edited appear. Basically, I want to attach a clickable properties plus some sort of action listener device to the text in a JTextpane,

Is this possible?

much appreciated,

java_gurl.
java_gurlAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Use a JEditorPane. setContentType("text/html"). Then you can use hyperlinks
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
You implement your own hyperlink listener so you can take any action you want in the event handler.
0
java_gurlAuthor Commented:
thanks CEHJ, i'll try that out in the next couple of hours and if it works i'll allocate you the points.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

java_gurlAuthor Commented:
oh just another tiny question. will i be able to use a style sheet for my text?
0
CEHJCommented:
Probably not - html support is pretty limited.
0
java_gurlAuthor Commented:
you get the points!
0
CEHJCommented:
:-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.