From 8de46b00b4e2df79a5b45111bcb981880fca21cf Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Mon, 12 May 2003 22:26:03 +0000 Subject: [PATCH] works.. but eatling lots of ram.. --- MooTrackView.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MooTrackView.java b/MooTrackView.java index 712918a..0b4618d 100644 --- a/MooTrackView.java +++ b/MooTrackView.java @@ -18,6 +18,7 @@ public class MooTrackView extends JPanel implements ActionListener { private Rectangle box; private JPopupMenu popup; private JMenuItem menuItem; + protected static int viewLength = 0; public MooTrackView (Track track) { @@ -92,7 +93,9 @@ public class MooTrackView extends JPanel implements ActionListener { while(findComponentAt(x, y) instanceof MooNoteElement || findComponentAt(x, y + height - 1) instanceof MooNoteElement) x += NOTE_WIDTH; elem.setBounds(x, y, NOTE_WIDTH, height); + if (viewLength < (y+height)) viewLength = y+height; } + setPreferredSize(new Dimension(200,viewLength)); } validate(); } @@ -100,7 +103,8 @@ public class MooTrackView extends JPanel implements ActionListener { public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; - for (int c = 0; c < (trackLength*NOTE_HEIGHT); c += NOTE_HEIGHT) { +//(trackLength*NOTE_HEIGHT) + for (int c = 0; c < viewLength ; c += NOTE_HEIGHT) { for (int r = 0; r < (10*NOTE_WIDTH); r += NOTE_WIDTH) { box = new Rectangle(r, c, NOTE_WIDTH, NOTE_HEIGHT); g2.setColor(Color.gray); -- 2.39.2