Changing the output font in java's swing

Started by
1 comment, last by K4MEl30N 18 years, 10 months ago
The subject pretty much explains my problem...I need to change the font that swing uses to output in a JTextArea. Im not sure what the default is, but it doesn't use an equal space for every character, which i need. Please help!
Advertisement
You can call the setFont(Font) function on the JTextArea to set the font.

To make a font with the same width for every character, do something like:

Font myFont = new Font("Monospaced", Font.PLAIN, size);

For the size parameter, choose whatever font size you want. Something like 10 or 12 will work probably.

Vovan
Wow thanks, I was deffinitly not expecting something so simple. Guess I missed that part of Sun's tutorial :P

This topic is closed to new replies.

Advertisement