Change appearance of lines in a JTextArea
I have a JTextArea that will send its contents over a socket one line at a time. As the lines are sent, I want them to change appearance, perhaps by going from black font to gray, or changing background/foreground color.
Is there a common "GUI pattern" for this?
I will be looping through the JTextArea, so right after sending the line off into the ether, I should be able to tweak its representation. I'm thinking something like this (pseudocode - "outgoing" is the name of the JTextArea):
Code:
for (int i = 0, i < outgoing.size, ++) {
writer.println(outgoing[i].getText());
outgoing[i].background = Color.black;
outgoing[i].foreground = Color.white;
sleep(10);
}
Does this makes sense/is it the way to do it/is it possible to do it similar to this?