3 import javax.sound.midi.*;
6 * The add dialog that pops up if the user clicks on the add track menuitem
8 * @author Björn Lanneskog
11 public class MooDialog extends JDialog {
13 private JLabel name, whichtoedit;
14 private JTextField textfield;
15 private JComboBox trackList, trackLust;
16 private JButton okbutton, cancelbutton;
17 public static final int ADD_TRACK = 1, DELETE_TRACK = 2, COPY_TRACK = 3, MOVE_TRACK = 4;
20 * Creates the add dialog
22 public MooDialog(int type) {
23 super(Moosique.getGUI(), "Add track", false);
25 Container pane = getContentPane();
28 Track[] tracks = Moosique.getSequence().getTracks();
33 name = new JLabel("Name of track", JLabel.CENTER);
35 textfield = new JTextField();
37 whichtoedit = new JLabel("Add after", JLabel.CENTER);
38 pane.add(whichtoedit);
39 trackList = new JComboBox();
40 for (int i = 1; i <= tracks.length; i++) trackList.addItem("Track " + i);
42 cancelbutton = new JButton("Cancel");
43 pane.add(cancelbutton);
44 okbutton = new JButton("OK");
47 name.setBounds(50, 10, 100, 20);
48 textfield.setBounds(40, 35, 120, 20);
49 whichtoedit.setBounds(50, 70, 100, 20);
50 trackList.setBounds(40, 95, 120, 20);
51 cancelbutton.setBounds(10, 150, 80, 30);
52 okbutton.setBounds(120, 150, 60, 30);
54 setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - this.getWidth()) / 2,
55 (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2);
64 whichtoedit = new JLabel("Delete track", JLabel.CENTER);
65 pane.add(whichtoedit);
66 trackList = new JComboBox();
67 for (int i = 1; i <= tracks.length; i++) trackList.addItem("Track " + i);
69 cancelbutton = new JButton("Cancel");
70 pane.add(cancelbutton);
71 okbutton = new JButton("OK");
74 whichtoedit.setBounds(50, 10, 100, 20);
75 trackList.setBounds(40, 35, 120, 20);
76 cancelbutton.setBounds(10, 90, 80, 30);
77 okbutton.setBounds(120, 90, 60, 30);
79 setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - this.getWidth()) / 2,
80 (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2);
89 name = new JLabel("Track to copy", JLabel.CENTER);
91 trackLust = new JComboBox();
92 for (int i = 1; i <= tracks.length; i++) trackLust.addItem("Track " + i);
94 whichtoedit = new JLabel("Insert after", JLabel.CENTER);
95 pane.add(whichtoedit);
96 trackList = new JComboBox();
97 for (int i = 1; i <= tracks.length; i++) trackList.addItem("Track " + i);
99 cancelbutton = new JButton("Cancel");
100 pane.add(cancelbutton);
101 okbutton = new JButton("OK");
104 name.setBounds(50, 10, 100, 20);
105 trackLust.setBounds(40, 35, 120, 20);
106 whichtoedit.setBounds(50, 70, 100, 20);
107 trackList.setBounds(40, 95, 120, 20);
108 cancelbutton.setBounds(10, 150, 80, 30);
109 okbutton.setBounds(120, 150, 60, 30);
111 setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - this.getWidth()) / 2,
112 (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2);
121 name = new JLabel("Track to move", JLabel.CENTER);
123 trackLust = new JComboBox();
124 for (int i = 1; i <= tracks.length; i++) trackLust.addItem("Track " + i);
126 whichtoedit = new JLabel("Insert after", JLabel.CENTER);
127 pane.add(whichtoedit);
128 trackList = new JComboBox();
129 for (int i = 1; i <= tracks.length; i++) trackList.addItem("Track " + i);
131 cancelbutton = new JButton("Cancel");
132 pane.add(cancelbutton);
133 okbutton = new JButton("OK");
136 name.setBounds(40, 10, 120, 20);
137 trackLust.setBounds(40, 35, 120, 20);
138 whichtoedit.setBounds(50, 70, 100, 20);
139 trackList.setBounds(40, 95, 120, 20);
140 cancelbutton.setBounds(10, 150, 80, 30);
141 okbutton.setBounds(120, 150, 60, 30);
143 setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - this.getWidth()) / 2,
144 (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2);