From 090ed9e7cda839261543f2992c67f1c94f3e6935 Mon Sep 17 00:00:00 2001 From: Einar Pehrson Date: Mon, 12 May 2003 15:23:24 +0000 Subject: [PATCH] *** empty log message *** --- MooTrackView.java | 18 +++++++++++++++--- Moosique.java | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/MooTrackView.java b/MooTrackView.java index fafab99..12c6bab 100644 --- a/MooTrackView.java +++ b/MooTrackView.java @@ -61,15 +61,27 @@ public class MooTrackView extends JPanel implements ActionListener { class NoteArea extends JPanel { + public static final int NOTE_SIZE = 20; + public NoteArea(Track track) { MidiEvent note; + MooNoteElement elem; + boolean isOccupied; + int x, y, height; + Insets insets = getInsets(); for (int i = 0; i < track.size(); i++) { note = track.get(i); if (note instanceof MooNote) { - add(new MooNoteElement((MooNote)note)); + MooNote mn = (MooNote)note; + elem = new MooNoteElement(mn); + add(elem); + x = insets.left; + y = insets.top + (int)(mn.getTick() / 24) * NOTE_SIZE; + height = (mn.getDuration() / 24) * NOTE_SIZE; + while(findComponentAt(x, y) != this || findComponentAt(x, y + height - 1) != this) x += NOTE_SIZE; + elem.setBounds(x, y, NOTE_SIZE, height); } } - validate(); } public void paintComponent(Graphics g) { @@ -100,4 +112,4 @@ public class MooTrackView extends JPanel implements ActionListener { } } } -} \ No newline at end of file +} diff --git a/Moosique.java b/Moosique.java index 8354504..c5f31e2 100644 --- a/Moosique.java +++ b/Moosique.java @@ -298,4 +298,4 @@ public class Moosique { if (synthesizer.isOpen()) synthesizer.close(); System.exit(0); } -} \ No newline at end of file +} -- 2.39.2