X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooInstrumentList.java;h=ed976dd4434d952c614a113bc77030980b2d6855;hb=2875ce498e9bf83ed635156599dd29a3c3b379de;hp=1864b690d4345fef3e3754f8cff86010045af513;hpb=964980cf244e780600db6d5e05d036edbb3a15da;p=moosique.git diff --git a/MooInstrumentList.java b/MooInstrumentList.java index 1864b69..ed976dd 100644 --- a/MooInstrumentList.java +++ b/MooInstrumentList.java @@ -3,24 +3,31 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; -/* +/** * A Combo Box where the instrument of the currently active channel can be selected. * - * @author Einar Pehrson + * @author Einar Pehrson, Michael Andreen */ public class MooInstrumentList extends JComboBox implements ActionListener { - public MooInstrumentList() { + protected int channel; + public MooInstrumentList(int chan) { super(instruments); - setFont(new Font("Times New Roman", Font.PLAIN, 10)); + setChannel(chan); + setFont(new Font("Helvetica", Font.PLAIN, 10)); addActionListener(this); } + public void setChannel(int chan){ + channel = chan; + setSelectedIndex(Moosique.getChannel(channel).getProgram()); + } + public void actionPerformed(ActionEvent e) { JComboBox box = (JComboBox)e.getSource(); int instrument = box.getSelectedIndex(); - Moosique.getActiveChannel().programChange(instrument); + Moosique.getChannel(channel).programChange(instrument); } public static final String[] instruments = { @@ -153,4 +160,4 @@ public class MooInstrumentList extends JComboBox implements ActionListener { " 126 Applause", " 127 Gunshot" }; -} \ No newline at end of file +}