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
Post a Comment