I almost have my GUI working ok, but in my JTextArea, I have two columns: One for whites moves, one for black. I'm trying to space these out using spaces, but some letters take up more space than other letters. The pic below should make it clear what my problem is. pic of GUI Blacks moved are not lined up neatly like white moves, does anyone know of a way to fix this?
I'm not sure how to do pics on here, so I just stuck it on my website
[ May 07, 2006: Message edited by: colin shuker ] [ May 07, 2006: Message edited by: colin shuker ]
Look up the setFont() method of JTextArea, and the Font class in the API specification. There are five font families:
Serif includes fonts like Time, SansSerif Arial, Monospaced (I think) Courier, and I am not sure about the other two.
I don't know whether you can use the \t escape character to align your white and black columns. Nor whether you would find it easier to use two text areas in columns next to each other one for white's move the other for black.
You can get attributes to add to your Font, as well as type, eg size, bold, italic, but not apparently underlining.
Joined: Apr 11, 2005
Thanks, I got that working fine now... There is one more thing (at least one ), but one for now...
Where jta is a JTextArea. When I append a String to jta, it displays correctly in the scrollpane. However once the scrollpane fills up, and the blue slider on the scrollbar appears, it stays at the top... so that you can only read the first part of whats in the scrollpane, not the new info that is being added.
I basically want the blue slider at the mottom of the scrollbar, so the user can see every new move that is displayed.
Is this possible, I don't see any methods for it in JScrollPane class. Perhaps I have to get the Scroll bar with getVerticalScrollBar(), and then set the position on that object.