-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatusLabel.java
More file actions
37 lines (31 loc) · 1.08 KB
/
Copy pathstatusLabel.java
File metadata and controls
37 lines (31 loc) · 1.08 KB
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
import javax.swing.*;
import java.awt.event.*;
class statusLabel extends JLabel
{
public statusLabel()
{
super();
setHorizontalAlignment(JLabel.CENTER);
new javax.swing.Timer(100,new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String recstat=""+Environment.canRecordGame();
int gn=game.turnNumber==0?1:game.turnNumber;
if(game.isGameActive())
{
String strtodraw="";
if(game.turnNumber>1)
strtodraw="Last move:"+gui.lastmovealgebraic+" "+"Moves : "+(gn-1)+recstat;
else
strtodraw="Moves : "+(gn-1)+recstat;
setText(strtodraw);
}
else
{
setText("Game Over. Last move:"+gui.lastmovealgebraic+" "+"Moves: "+(gn-1)+recstat);
}
}
}).start();
}
}