private NoteArea notes;
private Rectangle box;
private JPopupMenu popup;
+ private JPopupMenu notePopup;
private JMenuItem menuItem;
protected static int viewLength = 0;
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);
/**
* Updates the track view.
*/
- public void update() {
+ public void update(long tickPosition) {
repaint();
}
if (note instanceof MooNote) {
// Adds the note element to the note area.
MooNote mn = (MooNote)note;
- elem = new MooNoteElement(mn, mn.getDuration() / 24);
+ elem = new MooNoteElement(mn);
add(elem);
// Moves the note element to the appropriate place.
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());
}
}
}