forked from IF-LK-2020/wordle
moved gui to different folder
This commit is contained in:
43
gui (not in use)/Letter.java
Normal file
43
gui (not in use)/Letter.java
Normal file
@@ -0,0 +1,43 @@
|
||||
import java.awt.Color;
|
||||
|
||||
public class Letter {
|
||||
|
||||
public static final byte WHITE = -1;
|
||||
public static final byte GRAY = 0;
|
||||
public static final byte YELLOW = 1;
|
||||
public static final byte GREEN = 2;
|
||||
|
||||
private char letter;
|
||||
private byte color;
|
||||
|
||||
public Letter() {
|
||||
letter = 'A';
|
||||
color = (byte) ((byte) (Math.random() * 4) - 1);
|
||||
}
|
||||
|
||||
public void setColor(byte color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
switch (color) {
|
||||
case WHITE:
|
||||
return new Color(200, 200, 200);
|
||||
case GRAY:
|
||||
return new Color(100, 100, 100);
|
||||
case YELLOW:
|
||||
return new Color(220, 220, 0);
|
||||
case GREEN:
|
||||
return new Color(0, 220, 0);
|
||||
}
|
||||
return Color.BLACK;
|
||||
}
|
||||
|
||||
public void setLetter(char letter) {
|
||||
this.letter = letter;
|
||||
}
|
||||
|
||||
public char getLetter() {
|
||||
return letter;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user