I need to add items in a JtextArea and with its Description and a Price but i have a problem in aligning it. i want an output of this is like
Description
HTML In a JTextPane rather than JTextArea one could use HTML:
<html><table><tr><th>Description</th><th>....<tr><td>...
With CSS styles the most beautiful, requiring some effort.
String.format With a fixed-size font (monospaced) in a JTextArea one can do:
txtArea.setFont(new Font("monospaced", Font.PLAIN, 12));
txtArea.append(String.format("%-30s %15s %10d\n", desc, price, quanty));