import java.awt.*;
import java.awt.event.*;
-/*
+/**
* Graphical representation of a MIDI note.
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooNoteElement extends JPanel{
private MooNote note;
- /*
+ /**
* Creates a new note element.
* @param mn The note that will be graphically represented
*/
if (!(g instanceof Graphics2D))
return;
Graphics2D g2 = (Graphics2D)g;
+
+ String note = ""; //TODO: shoudl really change this name..
+ int pitch = this.note.getPitch();
+ switch( pitch % 12)
+ {
+ case 0: note = "C"; break;
+ case 1: note = "C#"; break;
+ case 2: note = "D"; break;
+ case 3: note = "D#"; break;
+ case 4: note = "E"; break;
+ case 5: note = "F"; break;
+ case 6: note = "F#"; break;
+ case 7: note = "G"; break;
+ case 8: note ="G#"; break;
+ case 9: note = "A"; break;
+ case 10: note = "A#"; break;
+ case 11: note = "B"; break;
+ }
+
+ g2.drawString(note +" "+(pitch/12), 2, 2);
- //Draw the note representation
}
}