]> ruin.nu Git - moosique.git/commitdiff
menu for elements..
authorMichael Andreen <harv@ruin.nu>
Tue, 13 May 2003 14:02:33 +0000 (14:02 +0000)
committerMichael Andreen <harv@ruin.nu>
Tue, 13 May 2003 14:02:33 +0000 (14:02 +0000)
MooTrackView.java

index c7850fe65b2eb4aeaed77d5d2f4b96028086641a..cba92728796318289308ea79601c293a6989fdf0 100644 (file)
@@ -18,6 +18,7 @@ public class MooTrackView extends JPanel implements ActionListener {
        private NoteArea notes;
        private Rectangle box;
        private JPopupMenu popup;
+       private JPopupMenu notePopup;
        private JMenuItem menuItem;
        protected static int viewLength = 0;
        
@@ -41,9 +42,12 @@ public class MooTrackView extends JPanel implements ActionListener {
                menuItem = new JMenuItem("Add...");
                menuItem.addActionListener(this);
                popup.add(menuItem);
+
+
+               notePopup = new JPopupMenu();
                menuItem = new JMenuItem("Preferences...");
                menuItem.addActionListener(this);
-               popup.add(menuItem);
+               notePopup.add(menuItem);
 
                notes.addMouseListener(new PopupListener());
                add(notes, BorderLayout.CENTER);
@@ -143,7 +147,10 @@ public class MooTrackView extends JPanel implements ActionListener {
 
                private void maybeShowPopup(MouseEvent e) {
                        if (e.isPopupTrigger()) {
-                               popup.show(e.getComponent(), e.getX(), e.getY());
+                               if (findComponentAt(e.getX(), e.getY()) instanceof MooNoteElement)
+                                       notePopup.show(e.getComponent(), e.getX(), e.getY());
+                               else
+                                       popup.show(e.getComponent(), e.getX(), e.getY());
                        }
                }
        }