-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI.java
More file actions
44 lines (31 loc) · 848 Bytes
/
UI.java
File metadata and controls
44 lines (31 loc) · 848 Bytes
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
package pong;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.text.DecimalFormat;
import javax.swing.JPanel;
public class UI extends JPanel {
Pong pon;
public String score1 = "Score Computer : ";
public String score2 = "Score Player : ";
Font arial_40;
double playTime;
DecimalFormat dFormat = new DecimalFormat("#0.00");
public UI(Pong pon) {
this.pon = pon;
arial_40 = new Font("Arial", Font.PLAIN, 30);
}
public void draw(Graphics2D g) {
g.setColor(Color.white);
g.setFont(arial_40);
g.drawString(score1 + pon.score1 , 430, 90);
g.setColor(Color.black);
g.setFont(arial_40);
g.drawString(score2 + pon.score2, 110, 90);
/*if(pon.score2 == 2) {
g.setColor(Color.black);
g.setFont(arial_40);
g.drawString("Player a gagne !", 300, 70);
}*/
}
}