feat: refactor font usage in ChessBoardView to use a constant for Comic Sans MS
Build & Test (NowChessSystems) TeamCity build finished

This commit is contained in:
2026-04-01 22:32:12 +02:00
parent 7722e11dfb
commit 136b586553
@@ -23,10 +23,11 @@ import de.nowchess.chess.notation.{FenExporter, FenParser, PgnExporter, PgnParse
class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends BorderPane: class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends BorderPane:
private val squareSize = 70.0 private val squareSize = 70.0
private val comicSansFontFamily = "Comic Sans MS"
private val boardGrid = new GridPane() private val boardGrid = new GridPane()
private val messageLabel = new Label { private val messageLabel = new Label {
text = "Welcome!" text = "Welcome!"
font = Font.font("Comic Sans MS", 16) font = Font.font(comicSansFontFamily, 16)
padding = Insets(10) padding = Insets(10)
} }
@@ -45,7 +46,7 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B
children = Seq( children = Seq(
new Label { new Label {
text = "Chess" text = "Chess"
font = Font.font("Comic Sans MS", 24) font = Font.font(comicSansFontFamily, 24)
style = "-fx-font-weight: bold;" style = "-fx-font-weight: bold;"
}, },
messageLabel messageLabel
@@ -69,17 +70,17 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B
alignment = Pos.Center alignment = Pos.Center
children = Seq( children = Seq(
new Button("Undo") { new Button("Undo") {
font = Font.font("Comic Sans MS", 12) font = Font.font(comicSansFontFamily, 12)
onAction = _ => if engine.canUndo then engine.undo() onAction = _ => if engine.canUndo then engine.undo()
style = "-fx-background-radius: 8; -fx-background-color: #B9DAD1;" style = "-fx-background-radius: 8; -fx-background-color: #B9DAD1;"
}, },
new Button("Redo") { new Button("Redo") {
font = Font.font("Comic Sans MS", 12) font = Font.font(comicSansFontFamily, 12)
onAction = _ => if engine.canRedo then engine.redo() onAction = _ => if engine.canRedo then engine.redo()
style = "-fx-background-radius: 8; -fx-background-color: #B9C2DA;" style = "-fx-background-radius: 8; -fx-background-color: #B9C2DA;"
}, },
new Button("Reset") { new Button("Reset") {
font = Font.font("Comic Sans MS", 12) font = Font.font(comicSansFontFamily, 12)
onAction = _ => engine.reset() onAction = _ => engine.reset()
style = "-fx-background-radius: 8; -fx-background-color: #E1EAA9;" 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 alignment = Pos.Center
children = Seq( children = Seq(
new Button("FEN Export") { new Button("FEN Export") {
font = Font.font("Comic Sans MS", 12) font = Font.font(comicSansFontFamily, 12)
onAction = _ => doFenExport() onAction = _ => doFenExport()
style = "-fx-background-radius: 8; -fx-background-color: #DAC4B9;" style = "-fx-background-radius: 8; -fx-background-color: #DAC4B9;"
}, },
new Button("FEN Import") { new Button("FEN Import") {
font = Font.font("Comic Sans MS", 12) font = Font.font(comicSansFontFamily, 12)
onAction = _ => doFenImport() onAction = _ => doFenImport()
style = "-fx-background-radius: 8; -fx-background-color: #DAD4B9;" style = "-fx-background-radius: 8; -fx-background-color: #DAD4B9;"
}, },
new Button("PGN Export") { new Button("PGN Export") {
font = Font.font("Comic Sans MS", 12) font = Font.font(comicSansFontFamily, 12)
onAction = _ => doPgnExport() onAction = _ => doPgnExport()
style = "-fx-background-radius: 8; -fx-background-color: #C4DAB9;" style = "-fx-background-radius: 8; -fx-background-color: #C4DAB9;"
}, },
new Button("PGN Import") { new Button("PGN Import") {
font = Font.font("Comic Sans MS", 12) font = Font.font(comicSansFontFamily, 12)
onAction = _ => doPgnImport() onAction = _ => doPgnImport()
style = "-fx-background-radius: 8; -fx-background-color: #B9DAC4;" style = "-fx-background-radius: 8; -fx-background-color: #B9DAC4;"
} }