How can I listen for changes to the text selection in a JTextArea?

John Zukowski

You can attach a CaretListener to a JTextComponent to find out when the caret moves. When the dot and mark properties of the CaretEvent are the same, it means nothing is selected. You have to go back to the JTextComponent to find out the exact text that is selected.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact