What font in Swing looks the same in all OS?

Instead, use a layout manager and a logical font family. This example with the Font below adds 24-point italic serif text to the center of a (default) BorderLayout to achieve a pleasing result on disparate platforms.

ta.setFont(new Font("Serif", Font.ITALIC, 24));

Mac OS X:

Mac

Windows 7:

Windows

Ubuntu Linux:

Linux

Leave a Comment