- 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);
- }
- calculateString();
- } 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);
+
+ /**
+ * Selects the note if mouse entered with the left mouse button pressed.
+ */
+ public void mouseEntered(MouseEvent e) {
+ mouseIn = true;
+ if (mtv.isLeftMouseButtonPressed()) {
+ select();
+ }
+ }
+
+ /**
+ * Registers mouse exited.
+ */
+ public void mouseExited(MouseEvent e) {
+ mouseIn = false;
+ }
+
+ /**
+ * Checks if the mouse is pressed.
+ * Increases the pitch or velocity if the right mouse button is pressed while holding CTRL.
+ * Decreases the pitch or velocity if the left mouse button is pressed while holding CTRL.
+ * @param e the event recieved.
+ */
+ public void mousePressed(MouseEvent e) {
+ if (e.isControlDown()) {
+ if (pitchRect.contains(e.getPoint())) {
+ if (SwingUtilities.isRightMouseButton(e)) {
+ note.transpose(1);
+ } else if (SwingUtilities.isLeftMouseButton(e)) {
+ note.transpose(-1);
+ }
+ Moosique.setEdited();
+ calculateString();
+ repaint();
+ } 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);
+ }
+ Moosique.setEdited();
+ calculateString();
+ repaint();