Hi Everyone,

Happy 2013 to all.I'm using JOption to print a table, how do I align the columns? I am using a single variable for the JOption. Example:

QTY ITEMS UNIT PIRCE AMOUNT
1 Milk-Anchor 100.00 100.00
10 Del Monte-Tomato Sauce 1000.00 1000.00

Any suggestion will be great.

All the best,
Petranilla

Thank you for the reply. Does it work in JOption. The requirement is to use JOption.

Many thanks.

Yes, it will work with JOptionPane, as long as you use String.format() to format it into a String. After that you can output the String using a JOptionPane.
I am aware that I linked to a page using System.out.printf() but it is analog for String.format().

Thank you very much for the help. Happy New Year!