]> ruin.nu Git - moosique.git/commitdiff
works.. but eatling lots of ram..
authorMichael Andreen <harv@ruin.nu>
Mon, 12 May 2003 22:26:03 +0000 (22:26 +0000)
committerMichael Andreen <harv@ruin.nu>
Mon, 12 May 2003 22:26:03 +0000 (22:26 +0000)
MooTrackView.java

index 712918afad081ed3d712349577e475b69e1a1d2c..0b4618d7a65cce2a875467c19df7421e1d98f7ca 100644 (file)
@@ -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);