X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooNoteElement.java;h=3b08887000f07f515cbbcfab170972ef6fb0cfe3;hb=5380690b9fc56b683d15765382669d79c50d3414;hp=ca1d5c2e9bb533f7c01914f59e2b9afce728c08e;hpb=c2644cb200b06d71a3e6c4548c37272228130c3d;p=moosique.git diff --git a/MooNoteElement.java b/MooNoteElement.java index ca1d5c2..3b08887 100644 --- a/MooNoteElement.java +++ b/MooNoteElement.java @@ -12,14 +12,17 @@ import java.awt.event.*; public class MooNoteElement extends JPanel { private MooNote note; + private int columns; private boolean selected; /** * Creates a new note element. - * @param mn The note that will be graphically represented + * @param mn the note that will be graphically represented + * @param rows the number of rows that the note will occupy */ public MooNoteElement (MooNote mn) { note = mn; + columns = mn.getDuration() / 24; } /** @@ -45,17 +48,12 @@ public class MooNoteElement extends JPanel { { super.paintComponent(g); - if (note == null) - return; - - if (!(g instanceof Graphics2D)) - return; + if (note == null || !(g instanceof Graphics2D)) return; Graphics2D g2 = (Graphics2D)g; String n = ""; int pitch = note.getPitch(); - switch( pitch % 12) - { + switch (pitch % 12) { case 0: n = "C"; break; case 1: n = "C#"; break; case 2: n = "D"; break; @@ -69,11 +67,17 @@ public class MooNoteElement extends JPanel { case 10: n = "A#"; break; case 11: n = "B"; break; } - g2.setFont(new Font("Helvetica", Font.PLAIN, 10)); - n = n +(pitch/12); - g2.drawString(n, 1, 11); - g2.drawString(""+note.getVelocity(),1,23); + /* + switch(columns) { + case 0: + case 1: + ... + } + */ + + g2.setFont(new Font("Helvetica", Font.PLAIN, 8)); + n = n +(pitch/12); + g2.drawString(n + " "+ note.getVelocity(), 1, 9); } - -} +} \ No newline at end of file