Now allows for fonts to be overridden via system properties

This commit is contained in:
nathan 2015-11-09 15:59:12 +01:00
parent 3cc7549a02
commit 2d170e9817

View File

@ -18,6 +18,7 @@ package dorkbox.util.growl;
import dorkbox.util.OS; import dorkbox.util.OS;
import dorkbox.util.ScreenUtil; import dorkbox.util.ScreenUtil;
import dorkbox.util.SwingUtil; import dorkbox.util.SwingUtil;
import dorkbox.util.SystemProps;
import dorkbox.util.tweenengine.BaseTween; import dorkbox.util.tweenengine.BaseTween;
import dorkbox.util.tweenengine.Tween; import dorkbox.util.tweenengine.Tween;
import dorkbox.util.tweenengine.TweenCallback; import dorkbox.util.tweenengine.TweenCallback;
@ -198,6 +199,12 @@ class GrowlPopup extends JFrame {
contentPane.setLayout(new BorderLayout(10, 5)); contentPane.setLayout(new BorderLayout(10, 5));
setContentPane(contentPane); setContentPane(contentPane);
// closebutton is the 'x' button, but it is really just a font
Font closeButtonFont = SwingUtil.getFontFromProperty(SystemProps.growl_closeButtonFontName, "Source Code Pro", Font.BOLD, 12);
Font mainTextFont = SwingUtil.getFontFromProperty(SystemProps.growl_titleTextFontName, "Source Code Pro", Font.BOLD, 14);
Font titleTextFont = SwingUtil.getFontFromProperty(SystemProps.growl_mainTextFontName, "Source Code Pro", Font.BOLD, 16);
// TITLE AND CLOSE BUTTON // TITLE AND CLOSE BUTTON
{ {
Box box = new Box(BoxLayout.X_AXIS); Box box = new Box(BoxLayout.X_AXIS);
@ -211,7 +218,7 @@ class GrowlPopup extends JFrame {
final JLabel titleLabel = new JLabel(); final JLabel titleLabel = new JLabel();
titleLabel.setForeground(titleText_FG); titleLabel.setForeground(titleText_FG);
titleLabel.setFont(SwingUtil.FONT_BOLD_16); titleLabel.setFont(titleTextFont);
titleLabel.setText(notification.title); titleLabel.setText(notification.title);
textBox.add(titleLabel); textBox.add(titleLabel);
@ -227,7 +234,7 @@ class GrowlPopup extends JFrame {
final JLabel closeButton = new JLabel(); final JLabel closeButton = new JLabel();
closeButton.setForeground(closeX_FG); closeButton.setForeground(closeX_FG);
closeButton.setFont(SwingUtil.FONT_BOLD_12); closeButton.setFont(closeButtonFont);
closeButton.setText("x"); closeButton.setText("x");
closeButton.setVerticalTextPosition(SwingConstants.TOP); closeButton.setVerticalTextPosition(SwingConstants.TOP);
@ -276,11 +283,11 @@ class GrowlPopup extends JFrame {
} }
text.append("</html>"); text.append("</html>");
JLabel helpLabel_1 = new JLabel(); JLabel mainTextLabel = new JLabel();
helpLabel_1.setForeground(mainText_FG); mainTextLabel.setForeground(mainText_FG);
helpLabel_1.setFont(SwingUtil.FONT_BOLD_14); mainTextLabel.setFont(mainTextFont);
helpLabel_1.setText(text.toString()); mainTextLabel.setText(text.toString());
contentPane.add(helpLabel_1, BorderLayout.CENTER); contentPane.add(mainTextLabel, BorderLayout.CENTER);
} }