• Post Reply Bookmark Topic Watch Topic
  • New Topic

Spell checker problem ?

 
Girish Vasmatkar
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to all,

I am designing a messenger for my project using Swing. I want to implement the spelling checking ability to my chat window such as when a user enters a wrong word the wrong entered word gets underlined. I want to know how to go about this such that the code continuously listens for wrong words entered in the JTextArea. Any help or suggestion is greatly appreciated.

Thanks & Regards,
Girish
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Girish Vasmatkar:
..the code continuously listens for wrong words entered in the JTextArea.


You can probably use the document listener for this.
I would approach it this way:

Use the document listener.
Figure out if the user has completed typing in a word (white space)
On such events, take the last typed word and pass it to the code which does the spell check.
If it is spelt wrong, use the highlighter or style or something to underline it. No need to process all the words always.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!