2 Attachment(s)
Print Formatting in Columns trouble
Having written a program that gets the mouses coordinates and the different RGB values of the pixel at those coordinates I then sought after recording the data in a text file. Ideally for easy viewing later I wanted each category separated into different columns, something like pic1 (smaller image).
Instead, I am getting results like pic2.
In attempt to format the text into columns, i just used tabs, however this does not seem to work properly... here is the code just for the printing (I am outputting to a text file):
Code:
record.println("X: " + X
+ "\tY: " + Y
+ "\tR: " + red
+ "\tG: " + green
+ "\tB: " + blue);
I did look at the Formatter class, however I found nothing of use.
I do know that in the Turing language you can format a print statement like so: ('put' is the Turing equivalent of 'System.out.println();')
Code:
put "hello":6
put "you"
And the output will display as "hello you" because hello is 5 characters long, but you specified the first put (print) statement to be 6 characters long.
Any ideas on how to solve this problem?
Thanks.