1

Basically I am implementing a search function in an ontology. So when I enter a keyword to search, it is searched in the ontology and the corresponding results are displayed in JTextpane. Now what I want is when user click certain terms in that result, it should again perform the same search function for that term as keyword and display it in JTextpane . So how can I make some text in JTextpane clickable and implement a function on clicking it? Eg :

For the keyword, cataract, it displays something like this
//description
cataract is a disease of Opthalmology
//description

so when I click Opthalmology, then i should be able to again implement the search for Opthalmology.

1 Answers1

0

Add a custom attribute to the clickable keywords (or detect the keywords by click using viewToModel to convert clicked point to Document's offset).

Then do your search and insert content.

May be you could provide an SSCCE to show what you have and tell what you would like to achieve.

StanislavL
  • 56,971
  • 9
  • 68
  • 98
  • This is what I'm searching the whole internet... @StanislavL can you please explain it clearly.. I really need your help – Gogo Jun 17 '15 at 16:38
  • @Gogo post a separate question with your particular needs. It's better to answer rather than add a common description. – StanislavL Jun 17 '15 at 17:03
  • thanks for your reply... Can you please check on it? – Gogo Jun 17 '15 at 17:10