+ public boolean isSelected() {
+ return selected;
+ }
+
+ /**
+ * Returns the note of this element.
+ * @return the note
+ */
+ public MooNote getNote() {
+ return note;
+ }
+
+ /**
+ * Selects the current NoteElement.
+ * @param state if the element should be selected
+ */
+ public void setSelected(boolean state) {
+ selected = state;
+ }
+
+ /**
+ * Draws the string that shows the note's properties.
+ * @param g The Graphics object used to draw the strings.
+ */
+ public void paintComponent(Graphics g)
+ {
+ super.paintComponent(g);
+ if (!(g instanceof Graphics2D)) return;
+ Graphics2D g2 = (Graphics2D)g;
+ g2.setFont(new Font("Helvetica", Font.PLAIN, 8));
+ /*
+ switch(columns) {
+ case 0:
+ case 1:
+ ...
+ }
+ */
+
+ g2.drawString(notePitch, 1, 8);
+ g2.drawString("" + noteVelocity, 21, 8);
+ }
+
+ /**
+ * Calculate what the string that shows the note properties should look like.
+ */
+ protected void calculateString(){
+
+ noteVelocity = "";
+ notePitch = "";
+ if(note == null) return;
+
+ int pitch = note.getPitch();
+ switch (pitch % 12) {
+ case 0: notePitch = "C"; break;
+ case 1: notePitch = "C#"; break;
+ case 2: notePitch = "D"; break;
+ case 3: notePitch = "D#"; break;
+ case 4: notePitch = "E"; break;
+ case 5: notePitch = "F"; break;
+ case 6: notePitch = "F#"; break;
+ case 7: notePitch = "G"; break;
+ case 8: notePitch = "G#"; break;
+ case 9: notePitch = "A"; break;
+ case 10: notePitch = "A#"; break;
+ case 11: notePitch = "B"; break;
+ }
+ notePitch += pitch / 12;
+ noteVelocity = ""+note.getVelocity();
+ }
+
+ /**
+ * Listener that checks the mouse actions on this element.
+ */
+ class MAdapter extends MouseAdapter {