JTextArea default font very small in Windows

Oleg Vazhnev picture Oleg Vazhnev · Jun 24, 2011 · Viewed 16.8k times · Source

I'm using platform look-and-fell and on Linux my JTextArea is pretty readable But on Windows it uses "Monospaced 9" and the text is very small.

Why and what is the best way to fix that?

Why default Windows look-and-fell uses such small font in JTextArea?

Answer

Denis Tulskiy picture Denis Tulskiy · Aug 8, 2011

Instead of creating new font, it is better to derive existing font, because this way you'll save the font set by platform look and feel, and it may also avoid problems with unicode characters:

textArea.setFont(textArea.getFont().deriveFont(12f)); // will only change size to 12pt