From b03e58b3e016e35ccf40d54e8ca5822a95197305 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 25 Mar 2014 12:57:12 +0200 Subject: [PATCH] Menu font name constant --- src/com/annimon/turrets/Constants.java | 1 + src/com/annimon/turrets/MenuPanel.java | 5 +++-- src/com/annimon/turrets/OptionsPanel.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/annimon/turrets/Constants.java b/src/com/annimon/turrets/Constants.java index 14c5753..53f9aec 100644 --- a/src/com/annimon/turrets/Constants.java +++ b/src/com/annimon/turrets/Constants.java @@ -13,6 +13,7 @@ public final class Constants { public static final int WIDTH = 800, HEIGHT = 600; public static final boolean RESIZABLE = false; public static final Dimension SCREEN_DIMENSION = new Dimension(WIDTH, HEIGHT); + public static final String MENU_FONT_NAME = "Stencil"; public static final Font GAME_FONT = new Font("Times New Roman", Font.PLAIN, 24); // Parameters diff --git a/src/com/annimon/turrets/MenuPanel.java b/src/com/annimon/turrets/MenuPanel.java index 791395e..aac00ee 100644 --- a/src/com/annimon/turrets/MenuPanel.java +++ b/src/com/annimon/turrets/MenuPanel.java @@ -1,5 +1,6 @@ package com.annimon.turrets; +import static com.annimon.turrets.Constants.MENU_FONT_NAME; import static com.annimon.turrets.Constants.SCREEN_DIMENSION; import com.annimon.turrets.util.GuiUtil; import com.annimon.turrets.util.Prefs; @@ -36,7 +37,7 @@ public final class MenuPanel extends JPanel { // Init menu list menuList = new JList<>(MENU_ITEMS); menuList.setOpaque(false); - menuList.setFont(new Font("Stencil", Font.BOLD, 42)); + menuList.setFont(new Font(MENU_FONT_NAME, Font.BOLD, 42)); menuList.setForeground(Color.GRAY); menuList.setBackground(Color.BLACK); menuList.setSelectionBackground(Color.BLACK); @@ -53,7 +54,7 @@ public final class MenuPanel extends JPanel { // Init title final JLabel titleLabel = new JLabel("Turrets Online"); titleLabel.setForeground(TITLE_COLOR); - titleLabel.setFont(new Font("Stencil", Font.BOLD, 70)); + titleLabel.setFont(new Font(MENU_FONT_NAME, Font.BOLD, 70)); titleLabel.setHorizontalAlignment(SwingConstants.CENTER); // Init panel diff --git a/src/com/annimon/turrets/OptionsPanel.java b/src/com/annimon/turrets/OptionsPanel.java index dd15af6..471f20a 100644 --- a/src/com/annimon/turrets/OptionsPanel.java +++ b/src/com/annimon/turrets/OptionsPanel.java @@ -1,5 +1,6 @@ package com.annimon.turrets; +import static com.annimon.turrets.Constants.MENU_FONT_NAME; import static com.annimon.turrets.Constants.SCREEN_DIMENSION; import com.annimon.turrets.util.ExceptionHandler; import com.annimon.turrets.util.Prefs; @@ -27,7 +28,7 @@ import javax.swing.text.MaskFormatter; */ public final class OptionsPanel extends JPanel { - private static final Font FONT = new Font("Stencil", 1, 30); + private static final Font FONT = new Font(MENU_FONT_NAME, 1, 30); private static final int VERT_INSET = 80, HOR_INSET = 50; private final JCheckBox soundCheckBox;