]> ruin.nu Git - moosique.git/commitdiff
moving TrackTitle outside the scroll..
authorMichael Andreen <harv@ruin.nu>
Mon, 12 May 2003 23:19:02 +0000 (23:19 +0000)
committerMichael Andreen <harv@ruin.nu>
Mon, 12 May 2003 23:19:02 +0000 (23:19 +0000)
MooTrackTitle.java
MooTrackView.java
MooView.java

index b32479fd43cd0fa05ff76fd2878f45cac28834e4..4243fd475e3271c7f5fc49c8099e482bbfd25a56 100644 (file)
@@ -22,7 +22,9 @@ public class MooTrackTitle extends JPanel {
         */
        public MooTrackTitle (Track track) {
                setLayout(new GridLayout(4,1));
+               setBorder(BorderFactory.createLineBorder(Color.black));
 
+               setPreferredSize(new Dimension(200,70));
                title = new JTextField(); // JTextField(String text, int columns) 
                title.setFont(Moosique.getGUI().FONT);
                title.addFocusListener(new TitleFocusListener());
@@ -73,4 +75,4 @@ public class MooTrackTitle extends JPanel {
                        // Update the MidiEvent containing the title of this track
                }
        }
-}
\ No newline at end of file
+}
index 1b090ffcf89689d373ecf0fc3f7c3d29edcb9222..864ed07b2fe6a30a4431d12084973ac9399ace09 100644 (file)
@@ -27,9 +27,9 @@ public class MooTrackView extends JPanel implements ActionListener {
                setLayout(new BorderLayout());
                this.setBorder(BorderFactory.createLineBorder(Color.black));
 
-               title = new MooTrackTitle(track);
-               title.setBorder(BorderFactory.createLineBorder(Color.black));
-               add(title, BorderLayout.NORTH);
+               //title = new MooTrackTitle(track);
+               //title.setBorder(BorderFactory.createLineBorder(Color.black));
+               //add(title, BorderLayout.NORTH);
 
                notes = new NoteArea(track);    
                notes.setBackground(Color.white);
@@ -130,4 +130,4 @@ public class MooTrackView extends JPanel implements ActionListener {
                        }
                }
        }
-}
\ No newline at end of file
+}
index 3f088bd5930f801d27e5adfafb3efa4b1ed0f256..1155b7a36fe52ab788ccd385ecb5e33e57c54deb 100644 (file)
@@ -9,20 +9,31 @@ import java.awt.event.*;
  * @author  Einar Pehrson
  */
 
-public class MooView extends JScrollPane {
+public class MooView extends JPanel {
 
        private JPanel trackPanel;
+       private JPanel titlePanel;
        private int numberOfTracks;
+       private JScrollPane trackViews;
+       private JScrollPane trackTitles;
 
        /** 
         * Creates the main view
         */
        public MooView(Track[] tracks) {
-               super(VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED);
-               numberOfTracks = tracks.length;
+               trackViews = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
                trackPanel = new JPanel(new GridLayout(1,3), true);
+               trackViews.setViewportView(trackPanel);
+
+               trackTitles = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+               titlePanel = new JPanel(new GridLayout(1,3),true);
+               trackTitles.setViewportView(titlePanel);
+
+               numberOfTracks = tracks.length;
                setTracks(tracks);
-               setViewportView(trackPanel);
+               setLayout(new BorderLayout());
+               add(trackTitles, BorderLayout.NORTH);
+               add(trackViews, BorderLayout.CENTER);
        }
 
        /** 
@@ -33,6 +44,7 @@ public class MooView extends JScrollPane {
                if (tracks.length == 1) {
                        // If MIDI file is of type 0, creates a view for the track.
                        trackPanel.add(new MooTrackView(tracks[0]));
+                       titlePanel.add(new MooTrackTitle(tracks[0]));
                } else {
                        // Creates dialog for progress bar.
                        JDialog progressDialog = new JDialog(Moosique.getGUI(), "Visualizing MIDI file...", false);
@@ -49,6 +61,7 @@ public class MooView extends JScrollPane {
                        trackPanel.setLayout(new GridLayout(1,tracks.length));
                        for (int i = 1; i < tracks.length; i++) {
                                trackPanel.add(new MooTrackView(tracks[i]));
+                               titlePanel.add(new MooTrackTitle(tracks[i]));
                                progressBar.setValue(i+1);
                        }
                        progressDialog.dispose();
@@ -73,7 +86,9 @@ public class MooView extends JScrollPane {
         */
        public void addTrackView(Track track, int index) {
                ((GridLayout)trackPanel.getLayout()).setColumns(++numberOfTracks);
+               ((GridLayout)titlePanel.getLayout()).setColumns(++numberOfTracks);
                trackPanel.add(new MooTrackView(track), index);
+               titlePanel.add(new MooTrackTitle(track), index);
                validate();
        }
 
@@ -86,4 +101,4 @@ public class MooView extends JScrollPane {
                ((GridLayout)trackPanel.getLayout()).setColumns(--numberOfTracks);
                validate();
        }
-}
\ No newline at end of file
+}