0

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 hrefs 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?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Jason
  • 1
  • 2

1 Answers1

0

You want JEditorPane.addHyperlinkListener to handle to event and load the relevant page or perform another action.

Tom Hawtin - tackline
  • 145,806
  • 30
  • 211
  • 305