From f024dae5fba8aec9c8b03aba6093dd252269169c Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Tue, 13 May 2003 14:02:33 +0000 Subject: [PATCH] menu for elements.. --- MooTrackView.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/MooTrackView.java b/MooTrackView.java index c7850fe..cba9272 100644 --- a/MooTrackView.java +++ b/MooTrackView.java @@ -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()); } } } -- 2.39.2