use of org.pushingpixels.substance.api.SubstanceLookAndFeel 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;
}
use of org.pushingpixels.substance.api.SubstanceLookAndFeel in project MtgDesktopCompanion by nicho92.
the class LookAndFeelProvider method getExtraLookAndFeel.
public LookAndFeelInfo[] getExtraLookAndFeel() {
if (!list.isEmpty())
return list.toArray(new LookAndFeelInfo[list.size()]);
Reflections classReflections = new Reflections("org.pushingpixels.substance.api.skin");
list = new ArrayList<>();
for (Class<? extends SubstanceLookAndFeel> c : classReflections.getSubTypesOf(SubstanceLookAndFeel.class)) {
try {
SubstanceLookAndFeel look = c.getConstructor(null).newInstance();
list.add(new LookAndFeelInfo(look.getID(), c.getName()));
} catch (Exception e) {
logger.error("Loading " + c, e);
}
}
return list.toArray(new LookAndFeelInfo[list.size()]);
}
Aggregations