}
private JMenu getMenuFontSize() {
if (log.isTraceEnabled()) log.trace(HelperLog.methodStart());
final JMenu result = new Menu(localizer.getValue(HelperResource.RES_ACTION_FONT_SIZE), controller.getScaledIcon(Icon.FONT),
localizer.getTooltip(HelperResource.RES_ACTION_FONT_SIZE), localizer.getMnemonic(HelperResource.RES_ACTION_FONT_SIZE));
final ButtonGroup group = new ButtonGroup();
final List<Integer> list = HelperCollection.getList(-4, -2, 0, 2, 4, 8, 12, 16, 24, 32, 48, 64);
for (final Integer value : list) {
final JMenuItem item = new MenuItemRadioButton(value.toString());
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
try {
SubstanceLookAndFeel.setFontPolicy(null);
// Get the default font set
final FontSet substanceCoreFontSet = SubstanceLookAndFeel.getFontPolicy().getFontSet("Substance", null); //$NON-NLS-1$
// Create the wrapper font set
final FontPolicy newFontPolicy = new FontPolicy() {
@Override
public FontSet getFontSet(final String lafName, final UIDefaults table) {
return new WrapperFontSet(substanceCoreFontSet, value);
}
};
// set the new font policy
SubstanceLookAndFeel.setFontPolicy(newFontPolicy);
data.setFontSizeOffset(value);
} catch (Exception ex) {
if (log.isWarnEnabled()) log.warn("Could not change the font size", ex); //$NON-NLS-1$
data.setFontSizeOffset(0);
}
}
});
item.setSelected(data.getFontSizeOffset() == value);
result.add(item);
group.add(item);
}
result.setEnabled(HelperString.contains(data.getLookAndFeel(), ID_SUBSTANCE_NS));
if (log.isTraceEnabled()) log.trace(HelperLog.methodExit(result));
return result;
}