I am making a text editor, And i want to make it when the user type a article then if the user select a specific word then change it's color the color will be changed and also if the user select the same word but in another place this word's color only will be changed
As indicated in this picture:
because of all of my search results was that i change only a word's color even if it repeated it will be also colored
I am trying in JtextPane, I have searched in "Oracle Java Docs" for the JtextPane methodes but i didn't found anything

It is necessary to use JTextPane. Just use
new FindManager(yourTextPane, Color.RED);.