]> ruin.nu Git - moosique.git/commitdiff
added comments
authorMichael Andreen <harv@ruin.nu>
Fri, 16 May 2003 14:36:44 +0000 (14:36 +0000)
committerMichael Andreen <harv@ruin.nu>
Fri, 16 May 2003 14:36:44 +0000 (14:36 +0000)
MooNoteElement.java

index e93eb298ace082ede63be2c0dafd84936f407a08..6f372349e5372c2e657f71333366075c0d4dfe50 100644 (file)
@@ -23,8 +23,8 @@ public class MooNoteElement extends JPanel {
 
        /** 
         * Creates a new note element.
+        * @param parent        The MooTrackView that this element will be painted on.
         * @param mn    the note that will be graphically represented
-        * @param rows  the number of rows that the note will occupy
         */
        public MooNoteElement (MooTrackView parent, MooNote mn) {
                mtv = parent;
@@ -68,7 +68,8 @@ public class MooNoteElement extends JPanel {
        }
 
        /**
-        *
+        * Draws the string that shows the note's properties.
+        * @param g     The Graphics object used to draw the strings.
         */
        public void paintComponent(Graphics g)
        {
@@ -88,6 +89,9 @@ public class MooNoteElement extends JPanel {
                g2.drawString("" + noteVelocity, 21, 9);
        }
 
+       /**
+        * Calculate what the string that shows the note properties should look like.
+        */
        protected void calculateString(){
 
                noteVelocity = ""; 
@@ -113,11 +117,25 @@ public class MooNoteElement extends JPanel {
                noteVelocity = ""+note.getVelocity();
        }
 
+       /**
+        * Gets the note that is element represents
+        * @return the MooNote object.
+        */
        public MooNote getNote(){
                return note;
        }
 
+       /**
+        * Listener that checks the mouse actions on this element.
+        */
        class MAdapter extends MouseAdapter {
+               /**
+                * Checks if the mouse is pressed.
+                * Pops up the menu if right mousebutton is used.
+                * Increases the pitch or velocity if the right mousebutton is pressed while holding ctrl down.
+                * Decreases the pitch or velocity if the left mousebutton is pressed while holding ctrl down.
+                * @param e The events recieved.
+                */
                public void mousePressed(MouseEvent e) {
                        if (e.isControlDown()) {
                                if (pitchRect.contains(e.getPoint())) {
@@ -142,6 +160,9 @@ public class MooNoteElement extends JPanel {
                }
        }
 
+       /**
+        * Listens on the actions made to the popupmenu.
+        */
        class PopupListener implements ActionListener {
                public void actionPerformed(ActionEvent e) {
                        Object source = e.getSource();
@@ -153,6 +174,9 @@ public class MooNoteElement extends JPanel {
                }
        }
 
+       /**
+        * Asks the MooTrackView that it's painted on to remove this element and the note.
+        */
        protected void remove(){
                mtv.removeNote(this, note);
        }