Skip to main content
gamedev.net
🔒 Locked

[java] Formating cosole output

Started by Zumichu Mar 16, 2000 at 3:45 PM 1 replies 1.3k views
Original Post
Zumichu
Zumichu
well basically my subject line is my question. How do you format standard output in java. can you set the width of a certain field of text for example.
[I did absolutely nothing, and it was everything that I thought it could be]
SiCrane
SiCrane
As far as I can tell the PrintStream class has no provision for formatting output. The best you could probably do is to preformat the output yourself using Strings, and output the Strings. Of course I only have a Java 1.0 reference with me. This may have changed in Java 2.0
Jim_Ross
Jim_Ross
I don''t think they''ve changed it either. What you could do is figure out how wide you want your strings to run, and override toString() of the given object or System.out.println(). The toString or println method would make sure that your text is shorter than a certain width, and if it isn''t, add line breaks and tabs to your desire.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.