Results 1 to 2 of 2
Thread: Java Keeping Text in One Place
- 04-09-2009, 06:50 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
Java Keeping Text in One Place
I'm having trouble trying to have the text outputted in the console be in this format:
Java Code:*************************************************** * Outputted Text * ***************************************************
keep the asterisk at the end in alignment with the others? Any help would be great.
- 04-09-2009, 07:27 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,716
- Rep Power
- 19
Use the String method length() to determine the length of the text in the heading and then calculate the number of spaces that must be used.
(Instead of printing lots of spaces you can use the String method format() to align and pad the string "*" with spaces. But just printing a bunch of spaces is easier unless you are familiar with String.format() or the various printf() methods.)
Similar Threads
-
how to place a file in remote machine using simple java class
By aradhya in forum Advanced JavaReplies: 10Last Post: 02-28-2012, 09:44 PM -
Keeping track of Copies + Comparisons in Sort Methods
By VinceGuad in forum New To JavaReplies: 0Last Post: 03-12-2009, 05:07 AM -
how to place the controls >
By makpandian in forum AWT / SwingReplies: 1Last Post: 12-18-2008, 07:17 AM -
Need some help bad, at wits end validating this form and keeping script.
By bastardpete in forum New To JavaReplies: 1Last Post: 08-27-2008, 05:27 AM -
POI for delete excel record with keeping the existing macros
By Jay in forum Advanced JavaReplies: 0Last Post: 07-31-2008, 11:44 AM
Bookmarks