this.track = track;
this.title = title;
insets = getInsets();
+ coords = new ArrayList(track.size() / 2);
+ selection = new TreeSet();
// Configures panel
setBackground(Color.white);
setLayout(null);
setPreferredSize(new Dimension(VIEW_WIDTH, 140 * NOTE_HEIGHT));
- placeNoteElements();
+ // Creates temporary variables
+ MidiEvent note;
+ MooNoteElement elem;
+ extraHeight = Toolkit.getDefaultToolkit().getScreenSize().height - 150;
+
+ // Places note elements
+ for (int i = 0; i < track.size(); i++) {
+ note = track.get(i);
+ if (note instanceof MooNote) {
+ // Adds the note element to the note area and moves it to the appropriate place.
+ MooNote mn = (MooNote)note;
+ elem = new MooNoteElement(this, mn);
+ add(elem);
+ layoutElement(elem, false);
+ }
+ }
+ setPreferredSize(new Dimension(VIEW_WIDTH, viewLength + extraHeight));
// Creates panel pop-up menu.
popup = new JPopupMenu();
}
/**
- * Creates note elements for all MooNotes in the track, and places them in the appropriate place.
+ * Creates note elements for all MooNotes in the given list, and places them in the appropriate place.
*/
- public void placeNoteElements() {
- // Empties the container
- removeAll();
- coords = new ArrayList(track.size() / 2);
- selection = new TreeSet();
-
+ public void placeNewNotes(java.util.List notes) {
// Creates temporary variables
MidiEvent note;
MooNoteElement elem;
extraHeight = Toolkit.getDefaultToolkit().getScreenSize().height - 150;
// Places note elements
- for (int i = 0; i < track.size(); i++) {
- note = track.get(i);
+ for (int i = 0; i < notes.size(); i++) {
+ note = (MidiEvent)notes.get(i);
if (note instanceof MooNote) {
// Adds the note element to the note area and moves it to the appropriate place.
MooNote mn = (MooNote)note;
add(elem);
layoutElement(elem, false);
}
- setPreferredSize(new Dimension(VIEW_WIDTH, viewLength + extraHeight));
}
+ setPreferredSize(new Dimension(VIEW_WIDTH, viewLength + extraHeight));
}
/**