?
Solved

Centering text output in a console

Posted on 2008-10-04
3
Medium Priority
?
1,097 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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 Month13 days, 1 hour left to enroll

777 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