What I mean, is that I have a simple 2x2 matrix that I want to print out to a JTextArea, however this matrix uses numbers that uses varying integer lengths, and I don't know what the lengths will be prior to the program executing. This means when I try to neatly format the output string it'll sometimes end up being untidy.
For example, I have a matrix like the one below:
| ham | spam |
ham | x | y |
spam | z | a |
However, depending on the length of the integers the format will change. Say if x was equal to 23, the whole row would be pushes along one space so it'll look untidy, like so:
| ham | spam |
ham | 23 | y |
spam | z | a |
I was just wondering if there was any way to avoid this, aside from using a lot of if statements and trial/error to get the string sizes correct. I realise it's purely an aesthetic thing. It's not crucial to my program's operation. I just like things looking good.