/* attempt to deal with prototype, bootstrap, jquery conflicts */ /* for dropdown menus */

Jump to content

Image of the Day

Day 17 -- a bunch more tools join the table :) #blender3d #screenshotsaturday #itssaturdaysomewhere #lowpoly #3D https://t.co/CYJucn0Lfv
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

[java] Formating cosole output

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Zumichu   Members   

122
Like
Likes
Like

Posted 16 March 2000 - 09:45 AM

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.

#2 SiCrane   Moderators   

11663
Like
Likes
Like

Posted 16 March 2000 - 07:00 PM

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

#3 Jim_Ross   Members   

122
Like
Likes
Like

Posted 17 March 2000 - 08:25 AM

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.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.