X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooTrackTitle.java;h=1d9171a84c2083909c24f8acd66ddc5e7e9ec63f;hb=f7c0dc0b216c60d93f722b040878a51399679fc2;hp=e229c6dfbc3da8165bb9e9a4d50b800f6a71ead3;hpb=48b314acf130d347f3c0e01ca7d8e9e90b5eb3b5;p=moosique.git diff --git a/MooTrackTitle.java b/MooTrackTitle.java index e229c6d..1d9171a 100644 --- a/MooTrackTitle.java +++ b/MooTrackTitle.java @@ -32,8 +32,6 @@ public class MooTrackTitle extends JPanel { title.addFocusListener(new TitleFocusListener()); add(title); - instruments = new MooInstrumentList(); - add(instruments); JPanel checkboxes = new JPanel(); checkboxes.setLayout(new GridLayout(1,3)); @@ -52,26 +50,23 @@ public class MooTrackTitle extends JPanel { } } - channel.addItemListener(new ItemListener(){ - public void itemStateChanged(ItemEvent e){ - Object ob = channel.getSelectedItem(); - if (ob instanceof Integer){ - int chan = ((Integer)ob).intValue(); - //set channel - MidiEvent me; - MooNote mn; - for (int j = 0; j < track.size(); j++) { - me = track.get(j); - if (me instanceof MooNote){ - mn = (MooNote)me; - mn.setChannel(chan); - System.out.println(ob); - } - } - } + instruments = new MooInstrumentList(channel.getSelectedIndex()); + + channel.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + int chan = channel.getSelectedIndex(); + MidiEvent me; + MooNote mn; + instruments.setChannel(channel.getSelectedIndex()); + for (int j = 0; j < track.size(); j++) { + me = track.get(j); + if (me instanceof MooNote){ + mn = (MooNote)me; + mn.setChannel(chan); + } + } }}); - add(channel); mute = new JCheckBox("Mute"); @@ -91,6 +86,9 @@ public class MooTrackTitle extends JPanel { mute.setSelected(false); }}); checkboxes.add(solo); + + add(instruments); + add(channel); add(checkboxes); }