From f2a6b00defcf7804b30e8d167015500e33d6cedb Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Tue, 6 May 2003 01:05:48 +0000 Subject: [PATCH] should now draw the text representation. --- MooNoteElement.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/MooNoteElement.java b/MooNoteElement.java index 40ab0a4..969433f 100644 --- a/MooNoteElement.java +++ b/MooNoteElement.java @@ -52,6 +52,26 @@ public class MooNoteElement extends JPanel{ 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); } -- 2.39.2