From 136b586553beffb65eab5057820719cd02cf1821 Mon Sep 17 00:00:00 2001 From: Janis Date: Wed, 1 Apr 2026 22:32:12 +0200 Subject: [PATCH] feat: refactor font usage in ChessBoardView to use a constant for Comic Sans MS --- .../de/nowchess/ui/gui/ChessBoardView.scala | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/ui/src/main/scala/de/nowchess/ui/gui/ChessBoardView.scala b/modules/ui/src/main/scala/de/nowchess/ui/gui/ChessBoardView.scala index b8d162a..8274cc1 100644 --- a/modules/ui/src/main/scala/de/nowchess/ui/gui/ChessBoardView.scala +++ b/modules/ui/src/main/scala/de/nowchess/ui/gui/ChessBoardView.scala @@ -23,10 +23,11 @@ import de.nowchess.chess.notation.{FenExporter, FenParser, PgnExporter, PgnParse class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends BorderPane: private val squareSize = 70.0 + private val comicSansFontFamily = "Comic Sans MS" private val boardGrid = new GridPane() private val messageLabel = new Label { text = "Welcome!" - font = Font.font("Comic Sans MS", 16) + font = Font.font(comicSansFontFamily, 16) padding = Insets(10) } @@ -45,7 +46,7 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B children = Seq( new Label { text = "Chess" - font = Font.font("Comic Sans MS", 24) + font = Font.font(comicSansFontFamily, 24) style = "-fx-font-weight: bold;" }, messageLabel @@ -69,17 +70,17 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B alignment = Pos.Center children = Seq( new Button("Undo") { - font = Font.font("Comic Sans MS", 12) + font = Font.font(comicSansFontFamily, 12) onAction = _ => if engine.canUndo then engine.undo() style = "-fx-background-radius: 8; -fx-background-color: #B9DAD1;" }, new Button("Redo") { - font = Font.font("Comic Sans MS", 12) + font = Font.font(comicSansFontFamily, 12) onAction = _ => if engine.canRedo then engine.redo() style = "-fx-background-radius: 8; -fx-background-color: #B9C2DA;" }, new Button("Reset") { - font = Font.font("Comic Sans MS", 12) + font = Font.font(comicSansFontFamily, 12) onAction = _ => engine.reset() style = "-fx-background-radius: 8; -fx-background-color: #E1EAA9;" } @@ -90,22 +91,22 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B alignment = Pos.Center children = Seq( new Button("FEN Export") { - font = Font.font("Comic Sans MS", 12) + font = Font.font(comicSansFontFamily, 12) onAction = _ => doFenExport() style = "-fx-background-radius: 8; -fx-background-color: #DAC4B9;" }, new Button("FEN Import") { - font = Font.font("Comic Sans MS", 12) + font = Font.font(comicSansFontFamily, 12) onAction = _ => doFenImport() style = "-fx-background-radius: 8; -fx-background-color: #DAD4B9;" }, new Button("PGN Export") { - font = Font.font("Comic Sans MS", 12) + font = Font.font(comicSansFontFamily, 12) onAction = _ => doPgnExport() style = "-fx-background-radius: 8; -fx-background-color: #C4DAB9;" }, new Button("PGN Import") { - font = Font.font("Comic Sans MS", 12) + font = Font.font(comicSansFontFamily, 12) onAction = _ => doPgnImport() style = "-fx-background-radius: 8; -fx-background-color: #B9DAC4;" }