3 import java.awt.event.*;
4 import javax.sound.midi.*;
7 * The title bar for each track with track name, channel, instrument etc.
9 * @author Andersson, Andreen, Lanneskog, Pehrson
13 public class MooTrackTitle extends JPanel {
15 private JTextField title;
16 private MooInstrumentList instruments;
17 private JComboBox channel;
18 private JCheckBox mute;
19 private JCheckBox solo;
21 * Creates the title bar.
23 public MooTrackTitle (Track track) {
24 setLayout(new GridLayout(4,1));
26 title = new JTextField(); // JTextField(String text, int columns)
27 title.setFont(Moosique.getGUI().FONT);
28 title.addFocusListener(new TitleFocusListener());
31 instruments = new MooInstrumentList();
34 JPanel checkboxes = new JPanel();
35 checkboxes.setLayout(new GridLayout(1,3));
37 channel = new JComboBox();
38 channel.setFont(Moosique.getGUI().FONT);
39 for (int i = 1; i <= 16; i++)
40 channel.addItem(new Integer(i));
41 channel.addItemListener(new ItemListener(){
42 public void itemStateChanged(ItemEvent e){
43 Object ob = channel.getSelectedItem();
44 if (ob instanceof Integer){
51 mute = new JCheckBox("Mute");
52 mute.setFont(Moosique.getGUI().FONT);
53 mute.addActionListener(new ActionListener(){
54 public void actionPerformed(ActionEvent event){
56 solo.setSelected(false);
60 solo = new JCheckBox("Solo");
61 solo.setFont(Moosique.getGUI().FONT);
62 solo.addActionListener(new ActionListener(){
63 public void actionPerformed(ActionEvent event){
65 mute.setSelected(false);
71 class TitleFocusListener extends FocusAdapter {
72 public void focusLost(FocusEvent e) {
73 // Update the MidiEvent containing the title of this track