?
Solved

Centering text output in a console

Posted on 2008-10-04
3
Medium Priority
?
1,102 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 60

Accepted Solution

by:
Kevin Cross earned 2000 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 60

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The Fluent Interface Design Pattern You can use the Fluent Interface (http://en.wikipedia.org/wiki/Fluent_interface) design pattern to make your PHP code easier to read and maintain.  "Fluent Interface" is an object-oriented design pattern that r…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month15 days, 12 hours left to enroll

850 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