Solved

Centering text output in a console

Posted on 2008-10-04
3
1,080 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
Comment Utility
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
Comment Utility
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
Comment Utility
>>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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Software development teams often use in-memory caches to improve performance. They want to speed up access to, or reduce load on, a backing store (database, file system, etc.) by keeping some or all of the data in memory.   You should implement a …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now