Reputation: 1
So, I have a JEditorPane
with a bunch of text, and I want to be able to click on some the text enclosed in a tag, and have it activate some function, similar to the onclick
in JavaScript with HTML. I've tried doing this with href
s and <a>
tags, but as I was not going to a website, it didn't work out for me.
So, how can I click on text enclosed in a tag in a JEditorPane
and then do something accordingly?
Upvotes: 0
Views: 96
Reputation: 147154
You want JEditorPane.addHyperlinkListener
to handle to event and load the relevant page or perform another action.
Upvotes: 0