-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPad.java
More file actions
56 lines (41 loc) · 959 Bytes
/
Copy pathPad.java
File metadata and controls
56 lines (41 loc) · 959 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
45
46
47
48
49
50
51
52
53
54
55
56
package Simon;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Arc2D;
import javax.sound.midi.MidiChannel;
public class Pad extends Arc2D.Double
{
private static final long serialVersionUID = 1L;
private static int numObjects = 0;
private final int id = numObjects;
private Color c;
private boolean isDarker = false;
int noteNumber;
public Pad(int x, int y, int w, int h, int startA, int extentA, int type, Color c, int noteNumber)
{
super(x, y, w, h, startA, extentA, type);
this.c = c;
numObjects++;
this.noteNumber = noteNumber;
}
public void fillArc(Graphics2D g2)
{
if(isDarker)
g2.setColor(c.darker());
else
g2.setColor(c);
g2.fill(this);
}
public int getID()
{
return id;
}
public void setIsDarker(boolean b)
{
isDarker = b;
}
public void sound(MidiChannel mc)
{
mc.noteOn(noteNumber, 1000);
}
}