From 6f345a1ba4d0a66dcc4c10558fe28ba50c8d33e5 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Fri, 16 May 2003 14:36:44 +0000 Subject: [PATCH] added comments --- MooNoteElement.java | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/MooNoteElement.java b/MooNoteElement.java index e93eb29..6f37234 100644 --- a/MooNoteElement.java +++ b/MooNoteElement.java @@ -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); } -- 2.39.2