Jump to content
  • Advertisement
Sign in to follow this  
K4MEl30N

Changing the output font in java's swing

This topic is 4896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Wow thanks, I was deffinitly not expecting something so simple. Guess I missed that part of Sun's tutorial :P

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!