I am making a text editor and the last step is to create a simple spell checker. I have managed to work out how find incorrect words but now I would like to format those words so that they are shown to be incorrect example underlining them or highlighting them.
How can you format one word in a jtextarea() differently to the rest?
public void Spell_Check()
{
String[] english = new String[26871];
String[] text_words = ((JTextArea) TabPane.getSelectedComponent()).getText().split(" ");
int count_words = 0;
try {
BufferedReader br = new BufferedReader(new FileReader("english.txt"));
String lineFromFile = "";
for(int i = 0; (lineFromFile = br.readLine()) != null; i++)
{
if(text_words[i] != lineFromFile )
{
text_words[i].setAttributes(51, 7, false);
}
}
} catch (Exception e) {
}
}