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.