-
Notifications
You must be signed in to change notification settings - Fork 0
/
Time.pde
46 lines (37 loc) · 983 Bytes
/
Time.pde
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
class Time {
private int textSize;
Time(int textSize) {
this.textSize = textSize;
}
void drawTime() {
//Draw time in the 2nd segment.
int hours = hour();
int minutes = minute();
int seconds = second();
String fixedHours;
String fixedMinutes;
String fixedSeconds;
if (hours < 10) {
fixedHours = "0" + Integer.toString(hours);
} else {
fixedHours = Integer.toString(hours);
}
if (minutes < 10) {
fixedMinutes = "0" + Integer.toString(minutes);
} else {
fixedMinutes = Integer.toString(minutes);
}
if (seconds < 10) {
fixedSeconds = "0" + Integer.toString(seconds);
} else {
fixedSeconds = Integer.toString(seconds);
}
fill(255);
textAlign(LEFT, BOTTOM);
textSize(this.textSize);
text(fixedHours + ":" + fixedMinutes, 10, 277);
textAlign(RIGHT, BOTTOM);
textSize(this.textSize/2);
text(fixedSeconds, 470, 207);
}
}