reading word by word form a text file
HI. .. I have written a spell checker applet program to check spelling for KANNADA script(Indic,devanagari script)...
(the logic is same as checking spelling for english words- I have a TERNARY SEARCH TREE AS DICTIONARY)
the input file is stored in utf-8 encoding format.
1) I want to read a single line from file and display in textArea. This should happen every time i click on LoadNextLineFromFile button
(is there any way other than stringbuffer.readLine()...
2) i need to select a word from textArea and place it in a text field and then search for spelling in Dictionary.-(I have used getSelectedText().. Its not working)
Is there any alternative Event Listener and Handler to get selected text from textarea and place it in textfield??
The text area displays UTF-8 encoding scripts as special characters which is not readable by users.
The logic to read single line & displaying it in TExtArea and then again displaying single word in textField is little confusing and im not able to get flow.... please help me solve this...
I am able to display list of spellings that match with words that i TYPE IN textField..
so dictionary part is working well..
Only thing is i need to take input from a text file...! and store back the changed word into file













getSelectedText not working?
I don't see why getSelectedText would not work for that. I've done something similar for a an app similar to a spell checker. I read the entire text in with getSelectedText, because I only wanted to check what they had selected, and then just used StringTokenizer to break it apart by word. I was not spell checking, but I still needed it word by word.
It could be that StringTokenizer might not be sufficient for what you are doing. It would not break apart every type of word.For example I did not put a space after the period in the last sentience. So the last part of my previous sentence would have been parsed as "word.For". Hyphenated words are also an issue. If this is the case then you would need to directly parse the string using such methods as substring and indexOf.