One of the really cool things I've noticed about Java is that it's very well defined. I write code and run it in one place, and then I run it in another place, and it does precisely the same thing. So when I upgraded my laptop to a new laptop I was surprised to discover that using a Font object on my old machine resulted in a monospaced font exactly like I wanted, but using a Font object defined exactly the same way on my new machine resulted in a variable width font. The code is:
That last comment means that I run this program by calling "java DrSt 0 10".
When I ran it on my old machine the letters, both upper case and lower case, fit snugly inside the drawn box; running it on my new machine, the lower case letters don't fill the box and the upper case letters overflow the box.
What I want is to be able to specify a monospaced font where I can predict ahead of time how much space it's going to take up, as a function of the width of the String object I'm using to call drawString() with.