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.addFocusListener(new TitleFocusListener());
30 instruments = new MooInstrumentList();
33 JPanel checkboxes = new JPanel();
34 checkboxes.setLayout(new GridLayout(1,3));
36 channel = new JComboBox();
37 channel.setFont(new Font("Helvetica", Font.PLAIN, 10));
38 for (int i = 1; i <= 16; i++)
39 channel.addItem(new Integer(i));
40 channel.addItemListener(new ItemListener(){
41 public void itemStateChanged(ItemEvent e){
42 Object ob = channel.getSelectedItem();
43 if (ob instanceof Integer){
50 mute = new JCheckBox("Mute");
51 mute.setFont(new Font("Helvetica", Font.PLAIN, 10));
52 mute.addActionListener(new ActionListener(){
53 public void actionPerformed(ActionEvent event){
55 solo.setSelected(false);
59 solo = new JCheckBox("Solo");
60 solo.setFont(new Font("Helvetica", Font.PLAIN, 10));
61 solo.addActionListener(new ActionListener(){
62 public void actionPerformed(ActionEvent event){
64 mute.setSelected(false);
70 class TitleFocusListener extends FocusAdapter {
71 public void focusLost(FocusEvent e) {
72 // Update the MidiEvent containing the title of this track