]> ruin.nu Git - moosique.git/blobdiff - MooTrackTitle.java
*** empty log message ***
[moosique.git] / MooTrackTitle.java
index cc17d170e620995ab22639fbec80b23db9e380a0..412fb246f183a521d86246068ca5ec5eb99b8a3f 100644 (file)
@@ -50,7 +50,10 @@ public class MooTrackTitle extends JPanel {
                MidiEvent event;
                for (int i = 0; i < track.size(); i++) {
                        event = track.get(i);
-                       if (event instanceof MooNote) channel = ((MooNote)event).getChannel();
+                       if (event instanceof MooNote) {
+                               channel = ((MooNote)event).getChannel();
+                               break;
+                       }
                }
                
                // Creates and places components.
@@ -58,32 +61,20 @@ public class MooTrackTitle extends JPanel {
                setBorder(BorderFactory.createLineBorder(Color.black));
 
                setPreferredSize(new Dimension(MooTrackView.VIEW_WIDTH,70));
-               title = new JTextField(trackName); // JTextField(String text, int columns) 
+               title = new JTextField(trackName);
                title.setFont(Moosique.getGUI().FONT);
                title.addFocusListener(new TitleFocusListener());
                add(title);
 
-               instruments = new MooInstrumentList(programChange);
-               add(instruments);
-
-               JPanel checkboxes = new JPanel();
-               checkboxes.setLayout(new GridLayout(1,3));
-
                channelBox = new JComboBox();
                channelBox.setFont(Moosique.getGUI().FONT);
                for (int i = 1; i <= 16; i++)
                        channelBox.addItem(new Integer(i));
 
-               for (int j = 0; j < track.size(); j++) {
-                       MidiEvent me = track.get(j);
-               if (me instanceof MooNote){
-                               MooNote mn = (MooNote)me;
-                               channelBox.setSelectedIndex(mn.getChannel());
-                               break;
-                       }
-        }
+               channelBox.setSelectedIndex(channel);
 
                instruments = new MooInstrumentList(channelBox.getSelectedIndex());
+               add(instruments);
 
                channelBox.addActionListener(new ActionListener(){
                                public void actionPerformed(ActionEvent e){
@@ -98,9 +89,11 @@ public class MooTrackTitle extends JPanel {
                                                        mn.setChannel(chan);
                                                }
                                }}});
-               channelBox.setSelectedIndex(channel);
                add(channelBox);
 
+               JPanel checkboxes = new JPanel();
+               checkboxes.setLayout(new GridLayout(1,3));
+
                mute = new JCheckBox("Mute");
                mute.setSelected(Moosique.getSequencer().getTrackMute(trackNum));
                mute.setFont(Moosique.getGUI().FONT);