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));
25 setBorder(BorderFactory.createLineBorder(Color.black));
27 setPreferredSize(new Dimension(200,70));
28 title = new JTextField(); // JTextField(String text, int columns)
29 title.setFont(Moosique.getGUI().FONT);
30 title.addFocusListener(new TitleFocusListener());
33 instruments = new MooInstrumentList();
36 JPanel checkboxes = new JPanel();
37 checkboxes.setLayout(new GridLayout(1,3));
39 channel = new JComboBox();
40 channel.setFont(Moosique.getGUI().FONT);
41 for (int i = 1; i <= 16; i++)
42 channel.addItem(new Integer(i));
43 channel.addItemListener(new ItemListener(){
44 public void itemStateChanged(ItemEvent e){
45 Object ob = channel.getSelectedItem();
46 if (ob instanceof Integer){
53 mute = new JCheckBox("Mute");
54 mute.setFont(Moosique.getGUI().FONT);
55 mute.addActionListener(new ActionListener(){
56 public void actionPerformed(ActionEvent event){
58 solo.setSelected(false);
62 solo = new JCheckBox("Solo");
63 solo.setFont(Moosique.getGUI().FONT);
64 solo.addActionListener(new ActionListener(){
65 public void actionPerformed(ActionEvent event){
67 mute.setSelected(false);
73 class TitleFocusListener extends FocusAdapter {
74 public void focusLost(FocusEvent e) {
75 // Update the MidiEvent containing the title of this track