public class MooDialog extends JDialog {
- private JLabel labelA, labelB, labelC, labelD, labelE, labelF;
- private JTextField textFieldA, textFieldB, textFieldC, textFieldD, textFieldE, textFieldF;
- private JTextField textFieldG, textFieldH, textFieldI, textFieldJ, textFieldK;
+ private JLabel labelA, labelB, labelC, labelD, labelE, labelF, labelG, labelH;
+ private JTextField textFieldA, textFieldB, textFieldC, textFieldD, textFieldE, textFieldF,
+ textFieldG, textFieldH, textFieldI, textFieldJ, textFieldK;
private JComboBox trackListA, trackListB;
private JButton okButton, cancelButton;
public static final int ADD_TRACK = 1,
INSERT_MEASURE = 7,
DELETE_MEASURE = 8,
SET_TEMPO = 9,
- PREFERENCES = 10;
+ PREFERENCES = 10,
+ TRANSPOSE = 11;
/**
* Constructor of the dialogs.
case DELETE_MEASURE: makeDeleteMeasureDialog(pane); break;
case SET_TEMPO: makeSetTempoDialog(pane); break;
case PREFERENCES: makePrefsDialog(pane); break;
+ case TRANSPOSE: makeTransposeDialog(pane, tracks); break;
}
}
/**
* Builds the set tempo dialog.
* @param pane The container to put the dialog in.
- * @param tracks A array containing miditracks.
*/
private void makeSetTempoDialog(Container pane) {
setTitle("Set tempo");
- // creating labels and adding them to a container
+
+ // create contents of dialog and add to container
+ // track edit-intervall labels
labelA = new JLabel("Measure", JLabel.CENTER);
pane.add(labelA);
labelB = new JLabel("Beat", JLabel.CENTER);
pane.add(labelB);
labelC = new JLabel("Tick", JLabel.CENTER);
pane.add(labelC);
+ // start and end labels
labelD = new JLabel("Start at:", JLabel.RIGHT);
pane.add(labelD);
labelE = new JLabel("End at:", JLabel.RIGHT);
pane.add(labelE);
+ // from-to label
labelF = new JLabel("to", JLabel.CENTER);
pane.add(labelF);
-
- // the starting textfields and adding them to the container
+ // start inputvaluefields
textFieldA = new JTextField();
pane.add(textFieldA);
textFieldB = new JTextField();
pane.add(textFieldB);
textFieldC = new JTextField();
pane.add(textFieldC);
- // ending textfields and adding them to the container
+ // end inputvaluefield
textFieldD = new JTextField();
pane.add(textFieldD);
textFieldE = new JTextField();
pane.add(textFieldE);
textFieldF = new JTextField();
pane.add(textFieldF);
- // the amount to edit textfields and adding them to a container
+ // the radiobuttonlists inputvaluefields
textFieldG = new JTextField();
pane.add(textFieldG);
textFieldH = new JTextField();
pane.add(textFieldJ);
textFieldK = new JTextField();
pane.add(textFieldK);
-
- // creating the buttons and adding them to the container
+ // the radiobuttonlist with associating titles
JRadioButton constant = new JRadioButton("Set constant tempo of:");
constant.setSelected(true);
pane.add(constant);
pane.add(scale);
JRadioButton add = new JRadioButton("Add to current tempo:");
pane.add(add);
-
- // creating a buttongroup and adding the buttons above
+ // a buttongroup for the radiobuttons
ButtonGroup group = new ButtonGroup();
group.add(constant);
group.add(change);
group.add(scale);
group.add(add);
-
- // creating the cancel and ok button
+ // ok and cancelbutton
cancelButton = new JButton("Cancel");
pane.add(cancelButton);
okButton = new JButton("OK");
pane.add(okButton);
-
+ // set bounds of track edit-intervall labels
labelA.setBounds(80, 25, 50, 20);
labelB.setBounds(145, 25, 50, 20);
labelC.setBounds(210, 25, 50, 20);
+ // set bounds of start and end labels
labelD.setBounds(20, 45, 60, 20);
labelE.setBounds(20, 65, 60, 20);
+ // set bounds of from-to label
labelF.setBounds(255, 125, 20 ,20);
-
+ // set bounds of start inputvaluefields
textFieldA.setBounds(80, 45, 50, 20);
textFieldB.setBounds(145, 45, 50, 20);
textFieldC.setBounds(210, 45, 50, 20);
+ // set bounds of end inputvaluefield
textFieldD.setBounds(80, 65, 50, 20);
textFieldE.setBounds(145, 65, 50, 20);
textFieldF.setBounds(210, 65, 50, 20);
-
- textFieldG.setBounds(205, 100, 35, 20);
+ // set bounds of radiobuttonlists inputvaluefields
+ textFieldG.setBounds(220, 100, 35, 20);
textFieldH.setBounds(220, 125, 35, 20);
textFieldI.setBounds(280, 125, 35, 20);
- textFieldJ.setBounds(170, 150, 35, 20);
- textFieldK.setBounds(200, 175, 35, 20);
-
+ textFieldJ.setBounds(220, 150, 35, 20);
+ textFieldK.setBounds(220, 175, 35, 20);
+ // set bounds of radiobuttonlist items
constant.setBounds(20, 100, 180, 20);
change.setBounds(20, 125, 200, 20);
scale.setBounds(20, 150, 150, 20);
add.setBounds(20, 175, 175, 20);
-
+ // set bounds of ok and cancelbutton
cancelButton.setBounds(75, 215, 80, 30);
okButton.setBounds(195, 215, 60, 30);
setVisible(true);
}
+ /**
+ * Builds the transpose dialog.
+ * @param pane The container to put the dialog in.
+ * @param tracks A array containing miditracks.
+ */
+ private void makeTransposeDialog(Container pane, Track[] tracks) {
+
+ setTitle("Transpose");
+ // create contents of dialog and add to container
+ // track edit-intervall labels
+ labelA = new JLabel("Measure", JLabel.CENTER);
+ pane.add(labelA);
+ labelB = new JLabel("Beat", JLabel.CENTER);
+ pane.add(labelB);
+ labelC = new JLabel("Tick", JLabel.CENTER);
+ pane.add(labelC);
+ // start and end labels
+ labelD = new JLabel("Start at:", JLabel.RIGHT);
+ pane.add(labelD);
+ labelE = new JLabel("End at:", JLabel.RIGHT);
+ pane.add(labelE);
+ // oktave inputvalue labels
+ labelF = new JLabel("Octaves", JLabel.LEFT);
+ pane.add(labelF);
+ labelG = new JLabel("1/2 octaves", JLabel.LEFT);
+ pane.add(labelG);
+ // what track to edig label
+ labelH = new JLabel("Track to edit:", JLabel.CENTER);
+ pane.add(labelH);
+ // combobox representing the tracks
+ trackListA = new JComboBox();
+ for (int i = 1; i <= tracks.length; i++) trackListA.addItem("Track " + i);
+ pane.add(trackListA);
+ // start inputvaluefields
+ textFieldA = new JTextField();
+ pane.add(textFieldA);
+ textFieldB = new JTextField();
+ pane.add(textFieldB);
+ textFieldC = new JTextField();
+ pane.add(textFieldC);
+ // end inputvaluefield
+ textFieldD = new JTextField();
+ pane.add(textFieldD);
+ textFieldE = new JTextField();
+ pane.add(textFieldE);
+ textFieldF = new JTextField();
+ pane.add(textFieldF);
+ // the radiobuttonlists inputvaluefields
+ textFieldG = new JTextField();
+ pane.add(textFieldG);
+ textFieldH = new JTextField();
+ pane.add(textFieldH);
+ // the radiobuttonlist with associating titles
+ JRadioButton up = new JRadioButton("Change up");
+ up.setSelected(true);
+ pane.add(up);
+ JRadioButton down = new JRadioButton("Change down");
+ pane.add(down);
+ // a buttongroup for the radiobuttons
+ ButtonGroup group = new ButtonGroup();
+ group.add(up);
+ group.add(down);
+ // ok and cancelbutton
+ cancelButton = new JButton("Cancel");
+ pane.add(cancelButton);
+ okButton = new JButton("OK");
+ pane.add(okButton);
+
+ // set bounds of track edit-intervall labels
+ labelA.setBounds(90, 70, 50, 20);
+ labelB.setBounds(155, 70, 50, 20);
+ labelC.setBounds(220, 70, 50, 20);
+ // set bounds of start and end labels
+ labelD.setBounds(30, 90, 60, 20);
+ labelE.setBounds(30, 110, 60, 20);
+ // set bounds of octave inputvaluefields
+ labelF.setBounds(210, 150, 80, 20);
+ labelG.setBounds(210, 175, 100, 20);
+ // set bounds of trackslist label
+ labelH.setBounds(30, 30, 100, 20);
+ // set bounds of start inputvaluefields
+ textFieldA.setBounds(90, 90, 50, 20);
+ textFieldB.setBounds(155, 90, 50, 20);
+ textFieldC.setBounds(220, 90, 50, 20);
+ // set bounds of end inputvaluefield
+ textFieldD.setBounds(90, 110, 50, 20);
+ textFieldE.setBounds(155, 110, 50, 20);
+ textFieldF.setBounds(220, 110, 50, 20);
+ // set bounds of octave inputvaluefields
+ textFieldG.setBounds(170, 150, 35, 20);
+ textFieldH.setBounds(170, 175, 35, 20);
+ // set bounds of radiobuttonlist items
+ up.setBounds(30, 150, 100, 20);
+ down.setBounds(30, 175, 120, 20);
+ // set bounds of tracklist
+ trackListA.setBounds(145, 30, 120, 20);
+ // set bounds of ok and cancelbutton
+ cancelButton.setBounds(75, 215, 80, 30);
+ okButton.setBounds(195, 215, 60, 30);
+
+ setResizable(false);
+ pack();
+ setSize(340,300);
+ setLocationRelativeTo(Moosique.getGUI());
+ setVisible(true);
+ }
private void makeTextDialog(Container pane, String filename) {
setTitle("User Manual");