How can I control the default font sizes for swing UI without quaqua?

We are trying to get quaqua from our application. We used the quaqua call to set the font size smaller with a call like this:

System.setProperty("Quaqua.sizeStyle", "small");

Is it easy to do the same without using quaqua? Or does anyone know another good look for OS X?

+3
source share
1 answer

I also had almost the same problem as the whole font for a particular font. The code below will change the font size for all properties *. Font in UIManager to a specific size

private static void setFontSize() {
    int fontSize = 12;
    Hashtable defaults = UIManager.getDefaults();
    Enumeration keys = defaults.keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();

        if ((key instanceof String) && (((String) key).endsWith(".font"))) {
            FontUIResource font = (FontUIResource) UIManager.get(key);
            defaults.put (key, new FontUIResource(font.getFontName(), font.getStyle(), fontSize));
        }
    }
 }
+5
source

Source: https://habr.com/ru/post/1714448/


All Articles