From 5b820290370f0f8eaf1094482c30cd6b3a447360 Mon Sep 17 00:00:00 2001 From: Federico Bagattoni Date: Tue, 9 Jul 2024 21:52:22 +0200 Subject: [PATCH] Solved checkstyles --- src/main/java/it/unibo/bombardero/view/GameCard.java | 4 +++- src/main/java/it/unibo/bombardero/view/GuideCard.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/it/unibo/bombardero/view/GameCard.java b/src/main/java/it/unibo/bombardero/view/GameCard.java index e0844f4e..d9358c2a 100644 --- a/src/main/java/it/unibo/bombardero/view/GameCard.java +++ b/src/main/java/it/unibo/bombardero/view/GameCard.java @@ -30,6 +30,8 @@ */ public final class GameCard extends GamePlayCard { + private static final int FONT_SIZE = 14; + private static final String TIMER_FORMAT = "mm:ss"; private final Image clockImage; @@ -84,7 +86,7 @@ public void paintComponent(final Graphics g) { super.paintComponent(g); final int fontYOffset = (int) (g.getFontMetrics(clockFont).getAscent() / 2); final SimpleDateFormat timerFormatter = new SimpleDateFormat(TIMER_FORMAT, Locale.ITALY); - g.setFont(clockFont.deriveFont(Font.PLAIN, 14)); + g.setFont(clockFont.deriveFont(Font.PLAIN, FONT_SIZE)); g.setColor(Color.BLACK); g.drawString(timerFormatter.format(timeLeft), timerPosition.width, timerPosition.height + fontYOffset); g.drawImage(clockImage, imageClockPosition.width, imageClockPosition.height, null); diff --git a/src/main/java/it/unibo/bombardero/view/GuideCard.java b/src/main/java/it/unibo/bombardero/view/GuideCard.java index 19464c90..59fe04a5 100644 --- a/src/main/java/it/unibo/bombardero/view/GuideCard.java +++ b/src/main/java/it/unibo/bombardero/view/GuideCard.java @@ -47,6 +47,7 @@ */ public final class GuideCard extends GamePlayCard { + private static final float FONT_SIZE = 9.0f; private static final int LAYOUT_ROWS = 5; private static final int LAYOUT_COLS = 1; @@ -118,7 +119,7 @@ public GuideCard( messageBox.setHorizontalTextPosition(SwingConstants.CENTER); messageBox.setVerticalTextPosition(SwingConstants.CENTER); - messageBox.setFont(font.deriveFont(9.0f)); + messageBox.setFont(font.deriveFont(FONT_SIZE)); back.setBorder(null); start.setBorder(null);