Changing the Font of a JOptionPane

When working with a high-resolution monitors, like the one in the Surface Pro 3 (did I tell you how awesome this baby is?), programs need to be configured to use larger fonts, otherwise their text is completely unreadable, especially when you are presenting to someone else and don’t want them to have to come closer to your laptop when your UX comes up. One example is the Java JOptionPane, which looked tiny every time I used it. So after some drilling in the net, found the solution (and also a way to change other parameters in the dialog). The font is derived from a global property of the UIManager class called OptionPane.messageFont, which is changed like this:

To get all the available fonts in your environment, you can run the following code:

A very long list of options that can be managed using the UIManager can be found here.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.