Solved

Centering text output in a console

Posted on 2008-10-04
3
1,084 Views
Last Modified: 2013-11-12
I need some help with centering a set of text outputs in the java console.
0
Comment
Question by:Ubrahbighead
  • 2
3 Comments
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 22643148
From the phrasing of the question, you seem to already know how to print text to the console; however, if every looking for anything to start out you can check the Java Tutorials:
http://java.sun.com/docs/books/tutorial/.

For centering, you will have to that manually by putting in spaces before the text.  One method to keep this uniform is to create a replicate function that you can use to replicate same string like " " or "-" x number of times across console.  See this posting in the Java forums on an example:
http://forums.sun.com/thread.jspa?threadID=608412&messageID=3348203.
0
 

Author Closing Comment

by:Ubrahbighead
ID: 31503128
I learn a lot more from the way you word your responses, instead of just clipping in some code - even though that would be easier for me! Keep up the good work ! Thanks :D
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 22643417
>>Grading Comments: I learn a lot more from the way you word your responses, instead of just clipping in some code - even though that would be easier for me! Keep up the good work ! Thanks :D

Figured if you are hear to learn, I will try my best to help that than give you code that you don't understand why it works. :) Sometimes that works, sometimes it doesn't.  Appreciate the feedback.  If I am ever answering your questions and try to implement code yourself and still have a specific question please feel free to post back.  I will do my best to answer completely.

Happy coding.

Regards,
Kevin
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Checkbox and ListView in Android Layout 4 67
How to write an English digest paper 6 50
Android development question 2 37
jsp login check 12 32
Introduction Many of the most common information processing tasks require sorting data sets.  For example, you may want to find the largest or smallest value in a collection.  Or you may want to order the data set in numeric or alphabetical order. …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question