0

I want to generate a clickable event from text area which contains a list of names of people. When we click on a certain name it must make a call to a method (which in turn is going to display the details of that person from a XML file).

Is this possible with text area? I have heard about JTextPane, but I need some other option.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
akzhere
  • 323
  • 4
  • 11

1 Answers1

4

Yes it's possible. Use viewToModel() method to get offset for the clicked point. Then use Utilities to getWordStart/getWordEnd methods to get the clicked name. Then just pass the name into desired function.

StanislavL
  • 56,971
  • 9
  • 68
  • 98