Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Help : identify words typed in JTextPane

  Asked By: Ruben    Date: Jan 31    Category: Java    Views: 744

i want to recognize the words wich i have typed in my editor. to
provide them proper coloring and velidation i can find characters by
keytyped function but how could i identify the previous word which
i have typed in my java editor.
i also want that when ever i press '.'what is the the word i typed
thanks all the members who gave me help previously and again
expecting same ones again



2 Answers Found

Answer #1    Answered By: Vidhya Iyer     Answered On: Jan 31

just look at the Document, DocumentListener and DocumentEvent interfaces...

Answer #2    Answered By: Alvin Nguyen     Answered On: Jan 31

Try implementing KeyListener, when a key is pressed put the TextField
through a StringTokenizer and then have a while loop that goes
through the TextField changing the color of the words. And to check
for a period just look at the last character in each token. I don't
know how to do that actual coloring part though.

Didn't find what you were looking for? Find more on Help : identify words typed in JTextPane Or get search suggestion and latest updates.