Search in sources :

Example 1 with SkinInfo

use of org.pushingpixels.substance.api.skin.SkinInfo in project jgnash by ccavanaugh.

the class ThemeManager method buildSubstanceMenu.

private JMenu buildSubstanceMenu() {
    LookAndFeel lf = UIManager.getLookAndFeel();
    JMenu substanceMenu = new JMenu(rb.getString("Menu.SubstanceThemes.Name"));
    for (SkinInfo info : SubstanceLookAndFeel.getAllSkins().values()) {
        JRadioButtonMenuItem button = new JRadioButtonMenuItem();
        button.setText(info.getDisplayName());
        button.setActionCommand(info.getClassName());
        // add the button to the global look and feel
        lfButtonGroup.add(button);
        button.addActionListener(e -> {
            Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);
            pref.put(LF, e.getActionCommand());
            restartUI();
        });
        substanceMenu.add(button);
        // select the button as the active L&F if it is the current skin
        if (lf instanceof SubstanceLookAndFeel) {
            if (SubstanceLookAndFeel.getCurrentSkin().getClass().getName().equals(info.getClassName())) {
                button.setSelected(true);
            }
        }
    }
    return substanceMenu;
}
Also used : SkinInfo(org.pushingpixels.substance.api.skin.SkinInfo) SubstanceLookAndFeel(org.pushingpixels.substance.api.SubstanceLookAndFeel) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) Preferences(java.util.prefs.Preferences) LookAndFeel(javax.swing.LookAndFeel) NimbusLookAndFeel(javax.swing.plaf.nimbus.NimbusLookAndFeel) SubstanceLookAndFeel(org.pushingpixels.substance.api.SubstanceLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) JMenu(javax.swing.JMenu)

Aggregations

Preferences (java.util.prefs.Preferences)1 JMenu (javax.swing.JMenu)1 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)1 LookAndFeel (javax.swing.LookAndFeel)1 MetalLookAndFeel (javax.swing.plaf.metal.MetalLookAndFeel)1 NimbusLookAndFeel (javax.swing.plaf.nimbus.NimbusLookAndFeel)1 SubstanceLookAndFeel (org.pushingpixels.substance.api.SubstanceLookAndFeel)1 SkinInfo (org.pushingpixels.substance.api.skin.SkinInfo)1