Results 1 to 6 of 6
- 03-30-2009, 02:40 AM #1
-
You may wish to describe your problem in greater detail as the answer will depend upon the requirements. Is this a Swing app with output in a JTextField? A console app?
If the latter, then you might want to look at System.out.printf(...) method or String.format(...). They both do the same thing. You'll have to read the tutorial and API several times to "get" this (I know that I had to on the first go-around), but it's eventually worthwhile reading.
- 03-30-2009, 03:03 AM #3
Thanks for your prompt answer.
I just realized how vague my question was! Sorry about that.
I am printing(outputing) from a string linkedList both in a console and in a text file.
I need to output each String(word), with different lengths, along with a corresponding #
so my output now looks like:
firstWord 1
anotherWord 2
word 3
but I want it to be aligned:
firstWord 1
anotherWord 2
word 3
could I use tab (\t) somehow or do I need to use a method?
tell me which tutorials I need to read for this and I'd be willing to do that , thanks :)
-
Have a look here:
Formatting (The Java™ Tutorials > Essential Classes > Basic I/O)
And here:
Formatter (Java Platform SE 6)
- 03-30-2009, 03:27 AM #5
I have looked at both links but they talk about formatting numbers.
I didn't see an example of what I want there :(
I need to format the output sting by adding a tab or 2 after each string or something like that!
-
Similar Threads
-
Java, output string, getting correct output? HELP!
By computerboyo in forum New To JavaReplies: 2Last Post: 02-25-2009, 11:44 PM -
Right Align columns in JTable
By Laura Warren in forum New To JavaReplies: 2Last Post: 12-18-2008, 09:01 PM -
Java Swing class capturing output to the console
By Java Tip in forum Java TipReplies: 0Last Post: 03-12-2008, 11:24 AM -
JTextArea - text align
By bradder in forum AWT / SwingReplies: 1Last Post: 11-29-2007, 07:08 PM -
how to write the output of the console to a file
By fred in forum New To JavaReplies: 1Last Post: 07-24-2007, 02:02 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks