-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rute.java
60 lines (53 loc) · 1.34 KB
/
Rute.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import java.awt.Color;
import java.awt.Font;
import javax.swing.*;
public class Rute extends JPanel{
JLabel label;
public boolean isScore;
public boolean isFree;
public int x, y;
public boolean isSnake;
Rute(int inx, int iny){
super();
label = new JLabel(" ");
label.setFont(new Font(Font.MONOSPACED, Font.BOLD, 30));
this.add(label);
this.setBorder(BorderFactory.createLineBorder(Color.black));
isScore = false;
isFree = true;
isSnake = false;
x = inx;
y = iny;
}
public void setText(String text){
label.setText(text);
}
public void bliSlange(){
label.setText("+");
this.setBackground(Color.green);
isScore = false;
isFree = false;
isSnake = true;
}
public void bliTom(){
label.setText(" ");
this.setBackground(Color.white);
isScore = false;
isFree = true;
isSnake = false;
}
public void bliHode(){
label.setText("O");
this.setBackground(Color.green);
isScore = false;
isFree = false;
isSnake = true;
}
public void bliScore(){
label.setText("$");
this.setBackground(Color.white);
isScore = true;
isFree = false;
isSnake = false;
}
}