I use a printstream to write the contents of an array list to a text file. An element of the list would look something like this:
Name: 2D19 Fingerprint: 170 Identity: Loop
The way I write it is through a for loop
ArrayList<String> array = new ArrayList<String>();
for(int i=0; i<array.size(); array++){
ps.println(array.get(i));
}
I want to know if it is possible to change the color of any of the text I write. I tried researching this but all the examples I’ve seen involve writing in a JTextArea, which I do not want to do.
It depends on the ‘media’ where you are printing at. The question is not very clear on this: you are saying you are writing strings to a text file, hence you have no colors there.
But you may print your strings in the HTML file and use HTML syntax to markup the written text, so when you preview such file, the text will be colored.
Or if you are printing to console, you may use ANSI escape codes for color, which works out of box on linux.