My program is a simple game where you are trying to figure out a random 5 letter word by guessing words and being told how many letters are the same (spin off of Jotto). Previous guesses and results are displayed in a JScrollPane. I am trying to get them to line up in columns. When the guess number gets into double digits everything shifts a character.
I am using a mono-space font and String.format() to try and pad the right number spaces between columns but it seems to be making the spaces smaller than other characters still. When printed to the command line it works fine and there the field width is actually 17 characters long instead of 10 or however many are in the picture.
scroll.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
....
guessList.add(0, String.format("%-17s" + result, numGuesses + ":" ));
Here guessList is a JList that is in the JScrollPane. I don't think that it could be causing the problem, but it is part of it.
I am considering switching to a JTable, but I think this should work and if not I would like to know why.