I'm used to using printf, but my research led me to believe I could use String.Format for setting up tables in a JTextArea and that it was essentially the same thing. This is for a rhythm game app. My code is:
private final String HEADER = "%-10s%-15s%-90s%-9s%-6s%-9s%-7s%-6s%-9s";
...
ranks.setText("");
ranks.append(String.format(HEADER + "\n", "Rank", "Difficulty", "Song Name", "Perfects", "Goods", "Averages", "Misses", "Boos", "MaxCombo"));
ranks.append(analyze.toString());
...
return String.format("%-10d%-15d%-90s%-9d%-6d%-9d%-7d%-6d%-9d\n ", rank, difficulty, songName, perfects, goods, averages, misses, boos, maxCombo);
for each component in an array analyze.toString returns the string shown. My format strings are identical sans everything being strings in the header and most everything being integers in the table so I don't know why my table comes out looking like this:
Like stated in the comments you should use a fixed-width font (or monospaced font) for such alignments to work.
Or as stated Denis Tulskiy, directly use the JTable component.