I want to color some words as soon as they are typed.
This is the code.
I use a Key_release listener.
When it catches the event i do this:
punt the text in a string check that there is the word that I want to color
start to color it in a while(true) cycle, which ends when there aren't any other occurrences of the word.
My problem is that it doesn't color only the range that I specified, but al the rest of the text that i type will have that color.
For this reason wrote ne next two lines
The problem is, that in this way it colors only a word, I can't use it to color more different words.
If you try to run the code, it will color the word "prova", but if you remove the comments surrounding this if
It won't color the word ADD.