From 8a41435360404f4769de4fecb44f495d571f8b03 Mon Sep 17 00:00:00 2001 From: "zeon-neon[bot]" <136533918+zeon-neon[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 18:52:30 +0000 Subject: [PATCH] enhancement(lint): Fix lint errors for projects/wordle-gui/Letter.java Co-authored-by: NeonGamerBot-QK Signed-off-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com> --- projects/wordle-gui/Letter.java | 81 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/projects/wordle-gui/Letter.java b/projects/wordle-gui/Letter.java index 87d8ffa..c35fd25 100644 --- a/projects/wordle-gui/Letter.java +++ b/projects/wordle-gui/Letter.java @@ -1,7 +1,6 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Font; - import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.SwingConstants; @@ -9,48 +8,46 @@ public class Letter { - private char letter = '_'; - private int status = 2; // -1 for not in word, 0 for wrong pos, 1 for right pos, 2 for inactive - private JLabel label = new JLabel(Character.toString(this.letter), SwingConstants.CENTER); - - - public Letter() { - - this.label.setText(Character.toString(this.letter).toUpperCase()); - this.label.setOpaque(true); - this.label.setBackground(Color.GRAY); - - this.label.setPreferredSize(new Dimension(50, 50)); - this.label.setFont(new Font("Arial", Font.BOLD, 16)); - Border border = BorderFactory.createLineBorder(Color.LIGHT_GRAY); - this.label.setBorder(border); - } - - public void setLetter(char letter, int status) { - this.letter = letter; - this.status = status; - this.label.setText(Character.toString(this.letter).toUpperCase()); - if (this.status == -1 | this.status == 2) { - this.label.setBackground(Color.GRAY); - } else if (status == 0) { - this.label.setBackground(Color.YELLOW); - } else if (status == 1) { - this.label.setBackground(Color.GREEN); - } - } - - public char getLetter() { - return this.letter; - } - - public int getStatus() { - return this.status; - } - - public JLabel getLabel() { - return this.label; + private char letter = '_'; + private int status = 2; // -1 for not in word, 0 for wrong pos, 1 for right pos, 2 for inactive + private JLabel label = new JLabel( + Character.toString(this.letter), + SwingConstants.CENTER + ); + + public Letter() { + this.label.setText(Character.toString(this.letter).toUpperCase()); + this.label.setOpaque(true); + this.label.setBackground(Color.GRAY); + + this.label.setPreferredSize(new Dimension(50, 50)); + this.label.setFont(new Font("Arial", Font.BOLD, 16)); + Border border = BorderFactory.createLineBorder(Color.LIGHT_GRAY); + this.label.setBorder(border); + } + + public void setLetter(char letter, int status) { + this.letter = letter; + this.status = status; + this.label.setText(Character.toString(this.letter).toUpperCase()); + if ((this.status == -1) | (this.status == 2)) { + this.label.setBackground(Color.GRAY); + } else if (status == 0) { + this.label.setBackground(Color.YELLOW); + } else if (status == 1) { + this.label.setBackground(Color.GREEN); } + } + public char getLetter() { + return this.letter; + } + public int getStatus() { + return this.status; + } -} \ No newline at end of file + public JLabel getLabel() { + return this.label; + } +}