Search code examples
javaswinglook-and-feelsubstance

Setting Substance Titlebar Font


I'm trying to change the font of my Substance applet.

In the documentation over at Substance look and feel - dark skins the titlebars have a custom font. I've read through the documentation for anything about setting the font, without any result.

This is how my title looks right now:

How do I change the Substance/JFrame titlebar font?


Solution

  • From OP's edit:

    SubstanceLookAndFeel.setFontPolicy(new FontPolicy() {
        public FontSet getFontSet(String arg0, UIDefaults arg1) {
            FontSet fontSet = new FontSet() {
                public FontUIResource getWindowTitleFont() {
                    return new FontUIResource(new Font("Serif", Font.PLAIN, 12)); //this is where the title font changes
                }
    
                public FontUIResource getTitleFont() {
                    return new FontUIResource(new Font("Arial", Font.PLAIN, 12));
                }
    
                public FontUIResource getSmallFont() {
                    return new FontUIResource(new Font("Arial", Font.PLAIN, 12));
                }
    
                public FontUIResource getMessageFont() {
                    return new FontUIResource(new Font("Arial", Font.PLAIN, 12));
                }
    
                public FontUIResource getMenuFont() {
                    return new FontUIResource(new Font("Arial", Font.PLAIN, 12));
                }
    
                public FontUIResource getControlFont() {
                    return new FontUIResource(new Font("Arial", Font.PLAIN, 12));
                }
            };
            return fontSet;
        }
    });