public void run() {
// reset the base font policy to null - this
// restores the original font policy (default size).
SubstanceLookAndFeel.setFontPolicy(null);
// Get the default font set
final FontSet substanceCoreFontSet = SubstanceLookAndFeel
.getFontPolicy().getFontSet("Substance",
null);
// Create the wrapper font set
FontPolicy newFontPolicy = new FontPolicy() {
public FontSet getFontSet(String lafName,
UIDefaults table) {
return new WrapperFontSet(
substanceCoreFontSet, newValue);
}
};
try {
GetFontPolicy.this
.setCursor(Cursor
.getPredefinedCursor(Cursor.WAIT_CURSOR));
// set the new font policy
SubstanceLookAndFeel
.setFontPolicy(newFontPolicy);
GetFontPolicy.this.setCursor(Cursor
.getDefaultCursor());
} catch (Exception exc) {
exc.printStackTrace();
}
}
});
}
}
});
panel.add(fontSizeSlider);
JButton jb = new JButton("Show font info");
jb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
FontPolicy fontPolicy = SubstanceLookAndFeel.getFontPolicy();
FontSet fontSet = fontPolicy.getFontSet("Substance", null);
String[] infoArray = new String[] {
"Control: " + fontSet.getControlFont(),
"Menu: " + fontSet.getMenuFont(),
"Message: " + fontSet.getMessageFont(),
"Small: " + fontSet.getSmallFont(),
"Title: " + fontSet.getTitleFont(),
"Window title: " + fontSet.getWindowTitleFont() };
JList infoList = new JList(infoArray);
JDialog infoDialog = new JDialog(GetFontPolicy.this,
"Font set info", true);
infoDialog.setLayout(new BorderLayout());
infoDialog.add(infoList, BorderLayout.CENTER);