swing - Java Pseudo-Hyperlink -


so working on in java right need display lots of jtextcomponents. need able turn words in text component hyperlink of sorts, specifically, when these words clicked, method called. please note, not looking real hyperlink, if click on text, function called. believe jtextpane solve problem using components, can't seem figure out..

yes, question exists, other 1 duplicate, , 1 links not answer question.

a jtextarea work too.

  • you use mouselistener , translate location of click via viewtomodel(point pt).
  • you use javax.swing.text.utilities.getrowstart(textarea, offset); if need start of row selected, , getrowend(...) end.
  • you have map<string, somelink> see if selected word linking word.

for example of this, please check answer here.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

How can I fetch data from a web server in an android application? -

jquery - How can I dynamically add a browser tab? -