- g2.setFont(new Font("Helvetica", Font.PLAIN, 8));
- n = n +(pitch/12);
- g2.drawString(n + " "+ note.getVelocity(), 1, 9);
+ g2.drawString(n, 1, 9);
+ g2.drawString("" + note.getVelocity(), 21, 9);
+ }
+
+ class MAdapter extends MouseAdapter {
+ public void mouseClicked(MouseEvent e) {
+ if (pitchRect.contains(e.getPoint())) {
+ if (SwingUtilities.isRightMouseButton(e)) {
+ note.setPitch(note.getPitch() + 1);
+ } else if (SwingUtilities.isLeftMouseButton(e)) {
+ note.setPitch(note.getPitch() - 1);
+ }
+ } else if (veloRect.contains(e.getPoint())) {
+ if (SwingUtilities.isRightMouseButton(e)) {
+ note.setVelocity(note.getVelocity() + 1);
+ } else if (SwingUtilities.isLeftMouseButton(e)) {
+ note.setVelocity(note.getVelocity() - 1);
+ }
+ }
+ e.getComponent().repaint();
+ }
+
+ public void mousePressed(MouseEvent e) {}
+
+ public void mouseReleased(MouseEvent e) {}