3 import java.awt.event.*;
4 import javax.sound.midi.*;
9 * A generator class for the application's dialogs.
11 * @author Björn Lanneskog
14 public class MooDialog extends JDialog {
16 private JLabel labelA, labelB, labelC, labelD, labelE, labelF, labelG, labelH;
17 private JTextField textFieldA, textFieldB, textFieldC, textFieldD, textFieldE, textFieldF,
18 textFieldG, textFieldH, textFieldI, textFieldJ, textFieldK;
19 private JComboBox trackListA, trackListB;
20 private JButton okButton, cancelButton;
21 public static final int ADD_TRACK = 1,
35 * Constructor of the dialogs.
37 public MooDialog(int type) {
38 super(Moosique.getGUI(), false);
40 Container pane = getContentPane();
43 Track[] tracks = Moosique.getSequence().getTracks();
46 case ADD_TRACK: makeAddDialog(pane, tracks); break;
47 case DELETE_TRACK: makeDelDialog(pane, tracks); break;
48 case COPY_TRACK: makeCopyDialog(pane, tracks); break;
49 case MOVE_TRACK: makeMoveDialog(pane, tracks); break;
50 case SET_POSITION: makeSetPositionDialog(pane); break;
51 case MANUAL: makeTextDialog(pane, "Manual.txt"); break;
52 case INSERT_MEASURE: makeInsertMeasureDialog(pane); break;
53 case DELETE_MEASURE: makeDeleteMeasureDialog(pane); break;
54 case SET_TEMPO: makeSetTempoDialog(pane); break;
55 case PREFERENCES: makePrefsDialog(pane); break;
56 case TRANSPOSE: makeTransposeDialog(pane, tracks); break;
57 case SCALE_VELOCITY: makeScaleVelocityDialog(pane, tracks); break;
62 * Builds the add track popupdialog.
63 * @param pane The container to put the dialog in.
64 * @param tracks A array containing miditracks.
66 private void makeAddDialog(Container pane, Track[] tracks) {
68 setTitle("Add track");
69 labelA = new JLabel("Name of track", JLabel.CENTER);
71 textFieldA = new JTextField();
73 labelB = new JLabel("Add after", JLabel.CENTER);
75 trackListA = new JComboBox();
76 for (int i = 1; i <= tracks.length; i++) trackListA.addItem("Track " + i);
78 cancelButton = new JButton("Cancel");
79 pane.add(cancelButton);
80 okButton = new JButton("OK");
83 labelA.setBounds(50, 10, 100, 20);
84 textFieldA.setBounds(40, 35, 120, 20);
85 labelB.setBounds(50, 70, 100, 20);
86 trackListA.setBounds(40, 95, 120, 20);
87 cancelButton.setBounds(10, 150, 80, 30);
88 okButton.setBounds(120, 150, 60, 30);
93 setLocationRelativeTo(Moosique.getGUI());
98 * Builds the delete track popupdialog.
99 * @param pane The container to put the dialog in.
100 * @param tracks A array containing miditracks.
102 private void makeDelDialog(Container pane, Track[] tracks) {
104 setTitle("Delete track");
105 labelB = new JLabel("Delete track", JLabel.CENTER);
107 trackListA = new JComboBox();
108 for (int i = 1; i <= tracks.length; i++) trackListA.addItem("Track " + i);
109 pane.add(trackListA);
110 cancelButton = new JButton("Cancel");
111 pane.add(cancelButton);
112 okButton = new JButton("OK");
115 labelB.setBounds(50, 10, 100, 20);
116 trackListA.setBounds(40, 35, 120, 20);
117 cancelButton.setBounds(10, 90, 80, 30);
118 okButton.setBounds(120, 90, 60, 30);
123 setLocationRelativeTo(Moosique.getGUI());
128 * Builds the copy track popupdialog.
129 * @param pane The container to put the dialog in.
130 * @param tracks A array containing miditracks.
132 private void makeCopyDialog(Container pane, Track[] tracks) {
134 setTitle("Copy Track");
135 labelA = new JLabel("Track to copy", JLabel.CENTER);
137 trackListA = new JComboBox();
138 for (int i = 1; i <= tracks.length; i++) trackListA.addItem("Track " + i);
139 pane.add(trackListA);
140 labelB = new JLabel("Insert after", JLabel.CENTER);
142 trackListB = new JComboBox();
143 for (int i = 1; i <= tracks.length; i++) trackListB.addItem("Track " + i);
144 pane.add(trackListB);
145 cancelButton = new JButton("Cancel");
146 pane.add(cancelButton);
147 okButton = new JButton("OK");
150 labelA.setBounds(50, 10, 100, 20);
151 trackListA.setBounds(40, 35, 120, 20);
152 labelB.setBounds(50, 70, 100, 20);
153 trackListB.setBounds(40, 95, 120, 20);
154 cancelButton.setBounds(10, 150, 80, 30);
155 okButton.setBounds(120, 150, 60, 30);
160 setLocationRelativeTo(Moosique.getGUI());
165 * Builds the move track popupdialog
166 * @param pane The container to put the dialog in.
167 * @param tracks A array containing miditracks.
169 private void makeMoveDialog(Container pane, Track[] tracks) {
171 setTitle("Move track");
172 labelA = new JLabel("Track to move", JLabel.CENTER);
174 trackListA = new JComboBox();
175 for (int i = 1; i <= tracks.length; i++) trackListA.addItem("Track " + i);
176 pane.add(trackListA);
177 labelB = new JLabel("Insert after", JLabel.CENTER);
179 trackListB = new JComboBox();
180 for (int i = 1; i <= tracks.length; i++) trackListB.addItem("Track " + i);
181 pane.add(trackListB);
182 cancelButton = new JButton("Cancel");
183 pane.add(cancelButton);
184 okButton = new JButton("OK");
187 labelA.setBounds(40, 10, 120, 20);
188 trackListA.setBounds(40, 35, 120, 20);
189 labelB.setBounds(50, 70, 100, 20);
190 trackListB.setBounds(40, 95, 120, 20);
191 cancelButton.setBounds(10, 150, 80, 30);
192 okButton.setBounds(120, 150, 60, 30);
197 setLocationRelativeTo(Moosique.getGUI());
202 * Builds the set position dialog.
203 * @param pane The container to put the dialog in.
204 * @param tracks A array containing miditracks.
206 private void makeSetPositionDialog(Container pane) {
208 setTitle("Set edit position");
209 labelA = new JLabel("Measure", JLabel.CENTER);
211 labelB = new JLabel("Beat", JLabel.CENTER);
213 labelC = new JLabel("Tick", JLabel.CENTER);
215 textFieldA = new JTextField();
216 pane.add(textFieldA);
217 textFieldB = new JTextField();
218 pane.add(textFieldB);
219 textFieldC = new JTextField();
220 pane.add(textFieldC);
221 cancelButton = new JButton("Cancel");
222 pane.add(cancelButton);
223 okButton = new JButton("OK");
226 labelA.setBounds(40, 25, 50, 20);
227 labelB.setBounds(105, 25, 50, 20);
228 labelC.setBounds(170, 25, 50, 20);
229 textFieldA.setBounds(40, 45, 50, 20);
230 textFieldB.setBounds(105, 45, 50, 20);
231 textFieldC.setBounds(170, 45, 50, 20);
232 cancelButton.setBounds(35, 90, 80, 30);
233 okButton.setBounds(155, 90, 60, 30);
238 setLocationRelativeTo(Moosique.getGUI());
243 * Builds the insert measure popupdialog.
244 * @param pane The container to put the dialog in.
246 private void makeInsertMeasureDialog(Container pane){
248 setTitle("Insert Measure");
249 labelA = new JLabel("Insert at:", JLabel.RIGHT);
251 labelB = new JLabel("Measure count:", JLabel.RIGHT);
253 textFieldA = new JTextField();
254 pane.add(textFieldA);
255 textFieldB = new JTextField();
256 pane.add(textFieldB);
257 cancelButton = new JButton("Cancel");
258 pane.add(cancelButton);
259 okButton = new JButton("OK");
262 labelA.setBounds(20, 20, 110 ,20);
263 labelB.setBounds(20, 50, 110, 20);
264 textFieldA.setBounds(140 ,20 , 40, 20);
265 textFieldB.setBounds(140,50, 40, 20);
266 cancelButton.setBounds(20 ,95 , 80, 30);
267 okButton.setBounds(120, 95, 60, 30);
272 setLocationRelativeTo(Moosique.getGUI());
277 * Builds the delete measure popupdialog.
278 * @param pane The container to put the dialog in.
280 private void makeDeleteMeasureDialog(Container pane) {
282 setTitle("Delete Measure");
283 labelA = new JLabel("Delete at:", JLabel.RIGHT);
285 labelB = new JLabel("Measure count:", JLabel.RIGHT);
287 textFieldA = new JTextField();
288 pane.add(textFieldA);
289 textFieldB = new JTextField();
290 pane.add(textFieldB);
291 cancelButton = new JButton("Cancel");
292 pane.add(cancelButton);
293 okButton = new JButton("OK");
296 labelA.setBounds(20, 20, 110 ,20);
297 labelB.setBounds(20, 50, 110, 20);
298 textFieldA.setBounds(140 ,20 , 40, 20);
299 textFieldB.setBounds(140,50, 40, 20);
300 cancelButton.setBounds(20 ,95 , 80, 30);
301 okButton.setBounds(120, 95, 60, 30);
306 setLocationRelativeTo(Moosique.getGUI());
311 * Builds the set tempo dialog.
312 * @param pane The container to put the dialog in.
314 private void makeSetTempoDialog(Container pane) {
316 setTitle("Set tempo");
318 // create contents of dialog and add to container
319 // track edit-intervall labels
320 labelA = new JLabel("Measure", JLabel.CENTER);
322 labelB = new JLabel("Beat", JLabel.CENTER);
324 labelC = new JLabel("Tick", JLabel.CENTER);
326 // start and end labels
327 labelD = new JLabel("Start at:", JLabel.RIGHT);
329 labelE = new JLabel("End at:", JLabel.RIGHT);
332 labelF = new JLabel("to", JLabel.CENTER);
334 // start inputvaluefields
335 textFieldA = new JTextField();
336 pane.add(textFieldA);
337 textFieldB = new JTextField();
338 pane.add(textFieldB);
339 textFieldC = new JTextField();
340 pane.add(textFieldC);
341 // end inputvaluefield
342 textFieldD = new JTextField();
343 pane.add(textFieldD);
344 textFieldE = new JTextField();
345 pane.add(textFieldE);
346 textFieldF = new JTextField();
347 pane.add(textFieldF);
348 // the radiobuttonlists inputvaluefields
349 textFieldG = new JTextField();
350 pane.add(textFieldG);
351 textFieldH = new JTextField();
352 pane.add(textFieldH);
353 textFieldI = new JTextField();
354 pane.add(textFieldI);
355 textFieldJ = new JTextField();
356 pane.add(textFieldJ);
357 textFieldK = new JTextField();
358 pane.add(textFieldK);
359 // the radiobuttonlist with associating titles
360 JRadioButton constant = new JRadioButton("Set constant tempo of:");
361 constant.setSelected(true);
363 JRadioButton change = new JRadioButton("Gradually change tempo:");
365 JRadioButton scale = new JRadioButton("Scale tempo in %:");
367 JRadioButton add = new JRadioButton("Add to current tempo:");
369 // a buttongroup for the radiobuttons
370 ButtonGroup group = new ButtonGroup();
375 // ok and cancelbutton
376 cancelButton = new JButton("Cancel");
377 pane.add(cancelButton);
378 okButton = new JButton("OK");
381 // set bounds of track edit-intervall labels
382 labelA.setBounds(80, 25, 50, 20);
383 labelB.setBounds(145, 25, 50, 20);
384 labelC.setBounds(210, 25, 50, 20);
385 // set bounds of start and end labels
386 labelD.setBounds(20, 45, 60, 20);
387 labelE.setBounds(20, 65, 60, 20);
388 // set bounds of from-to label
389 labelF.setBounds(255, 125, 20 ,20);
390 // set bounds of start inputvaluefields
391 textFieldA.setBounds(80, 45, 50, 20);
392 textFieldB.setBounds(145, 45, 50, 20);
393 textFieldC.setBounds(210, 45, 50, 20);
394 // set bounds of end inputvaluefield
395 textFieldD.setBounds(80, 65, 50, 20);
396 textFieldE.setBounds(145, 65, 50, 20);
397 textFieldF.setBounds(210, 65, 50, 20);
398 // set bounds of radiobuttonlists inputvaluefields
399 textFieldG.setBounds(220, 100, 35, 20);
400 textFieldH.setBounds(220, 125, 35, 20);
401 textFieldI.setBounds(280, 125, 35, 20);
402 textFieldJ.setBounds(220, 150, 35, 20);
403 textFieldK.setBounds(220, 175, 35, 20);
404 // set bounds of radiobuttonlist items
405 constant.setBounds(20, 100, 180, 20);
406 change.setBounds(20, 125, 200, 20);
407 scale.setBounds(20, 150, 150, 20);
408 add.setBounds(20, 175, 175, 20);
409 // set bounds of ok and cancelbutton
410 cancelButton.setBounds(75, 215, 80, 30);
411 okButton.setBounds(195, 215, 60, 30);
416 setLocationRelativeTo(Moosique.getGUI());
421 * Builds the transpose dialog.
422 * @param pane The container to put the dialog in.
423 * @param tracks A array containing miditracks.
425 private void makeTransposeDialog(Container pane, Track[] tracks) {
427 setTitle("Transpose");
428 // create contents of dialog and add to container
429 // track edit-intervall labels
430 labelA = new JLabel("Measure", JLabel.CENTER);
432 labelB = new JLabel("Beat", JLabel.CENTER);
434 labelC = new JLabel("Tick", JLabel.CENTER);
436 // start and end labels
437 labelD = new JLabel("Start at:", JLabel.RIGHT);
439 labelE = new JLabel("End at:", JLabel.RIGHT);
441 // oktave inputvalue labels
442 labelF = new JLabel("Octaves", JLabel.LEFT);
444 labelG = new JLabel("1/2 octaves", JLabel.LEFT);
446 // what track to edit label
447 labelH = new JLabel("Track to edit:", JLabel.CENTER);
449 // combobox representing the tracks
450 trackListA = new JComboBox();
451 for (int i = 1; i <= tracks.length; i++) trackListA.addItem("Track " + i);
452 pane.add(trackListA);
453 // start inputvaluefields
454 textFieldA = new JTextField();
455 pane.add(textFieldA);
456 textFieldB = new JTextField();
457 pane.add(textFieldB);
458 textFieldC = new JTextField();
459 pane.add(textFieldC);
460 // end inputvaluefield
461 textFieldD = new JTextField();
462 pane.add(textFieldD);
463 textFieldE = new JTextField();
464 pane.add(textFieldE);
465 textFieldF = new JTextField();
466 pane.add(textFieldF);
467 // the radiobuttonlists inputvaluefields
468 textFieldG = new JTextField();
469 pane.add(textFieldG);
470 textFieldH = new JTextField();
471 pane.add(textFieldH);
472 // the radiobuttonlist with associating titles
473 JRadioButton up = new JRadioButton("Change up");
474 up.setSelected(true);
476 JRadioButton down = new JRadioButton("Change down");
478 // a buttongroup for the radiobuttons
479 ButtonGroup group = new ButtonGroup();
482 // ok and cancelbutton
483 cancelButton = new JButton("Cancel");
484 pane.add(cancelButton);
485 okButton = new JButton("OK");
488 // set bounds of track edit-intervall labels
489 labelA.setBounds(90, 70, 50, 20);
490 labelB.setBounds(155, 70, 50, 20);
491 labelC.setBounds(220, 70, 50, 20);
492 // set bounds of start and end labels
493 labelD.setBounds(30, 90, 60, 20);
494 labelE.setBounds(30, 110, 60, 20);
495 // set bounds of octave inputvaluefields
496 labelF.setBounds(210, 150, 80, 20);
497 labelG.setBounds(210, 175, 100, 20);
498 // set bounds of trackslist label
499 labelH.setBounds(30, 30, 100, 20);
500 // set bounds of start inputvaluefields
501 textFieldA.setBounds(90, 90, 50, 20);
502 textFieldB.setBounds(155, 90, 50, 20);
503 textFieldC.setBounds(220, 90, 50, 20);
504 // set bounds of end inputvaluefield
505 textFieldD.setBounds(90, 110, 50, 20);
506 textFieldE.setBounds(155, 110, 50, 20);
507 textFieldF.setBounds(220, 110, 50, 20);
508 // set bounds of octave inputvaluefields
509 textFieldG.setBounds(170, 150, 35, 20);
510 textFieldH.setBounds(170, 175, 35, 20);
511 // set bounds of radiobuttonlist items
512 up.setBounds(30, 150, 100, 20);
513 down.setBounds(30, 175, 120, 20);
514 // set bounds of tracklist
515 trackListA.setBounds(145, 30, 120, 20);
516 // set bounds of ok and cancelbutton
517 cancelButton.setBounds(75, 215, 80, 30);
518 okButton.setBounds(195, 215, 60, 30);
523 setLocationRelativeTo(Moosique.getGUI());
528 * Builds the scale velocity dialog.
529 * @param pane The container to put the dialog in.
530 * @param tracks A array containing miditracks.
532 private void makeScaleVelocityDialog(Container pane, Track[] tracks) {
534 setTitle("Scale velocity");
536 // create contents of dialog and add to container
537 // track edit-intervall labels
538 labelA = new JLabel("Measure", JLabel.CENTER);
540 labelB = new JLabel("Beat", JLabel.CENTER);
542 labelC = new JLabel("Tick", JLabel.CENTER);
544 // start and end labels
545 labelD = new JLabel("Start at:", JLabel.RIGHT);
547 labelE = new JLabel("End at:", JLabel.RIGHT);
550 labelF = new JLabel("to", JLabel.CENTER);
552 // what track to edit label
553 labelG = new JLabel("Track to edit:", JLabel.CENTER);
555 // combobox representing the tracks
556 trackListA = new JComboBox();
557 for (int i = 1; i <= tracks.length; i++) trackListA.addItem("Track " + i);
558 pane.add(trackListA);
559 // start inputvaluefields
560 textFieldA = new JTextField();
561 pane.add(textFieldA);
562 textFieldB = new JTextField();
563 pane.add(textFieldB);
564 textFieldC = new JTextField();
565 pane.add(textFieldC);
566 // end inputvaluefield
567 textFieldD = new JTextField();
568 pane.add(textFieldD);
569 textFieldE = new JTextField();
570 pane.add(textFieldE);
571 textFieldF = new JTextField();
572 pane.add(textFieldF);
573 // the radiobuttonlists inputvaluefields
574 textFieldG = new JTextField();
575 pane.add(textFieldG);
576 textFieldH = new JTextField();
577 pane.add(textFieldH);
578 textFieldI = new JTextField();
579 pane.add(textFieldI);
580 textFieldJ = new JTextField();
581 pane.add(textFieldJ);
582 textFieldK = new JTextField();
583 pane.add(textFieldK);
584 // the radiobuttonlist with associating titles
585 JRadioButton constant = new JRadioButton("Change all values to:");
586 constant.setSelected(true);
588 JRadioButton change = new JRadioButton("Gradually change value:");
590 JRadioButton scale = new JRadioButton("Scale values to %:");
592 JRadioButton add = new JRadioButton("Add to current value:");
594 // a buttongroup for the radiobuttons
595 ButtonGroup group = new ButtonGroup();
600 // ok and cancelbutton
601 cancelButton = new JButton("Cancel");
602 pane.add(cancelButton);
603 okButton = new JButton("OK");
606 // set bounds of track edit-intervall labels
607 labelA.setBounds(80, 75, 50, 20);
608 labelB.setBounds(145, 75, 50, 20);
609 labelC.setBounds(210, 75, 50, 20);
610 // set bounds of start and end labels
611 labelD.setBounds(20, 95, 60, 20);
612 labelE.setBounds(20, 115, 60, 20);
613 // set bounds of from-to label
614 labelF.setBounds(255, 175, 20 ,20);
615 // set bounds of trackslist label
616 labelG.setBounds(30, 30, 100, 20);
617 // set bounds of start inputvaluefields
618 textFieldA.setBounds(80, 95, 50, 20);
619 textFieldB.setBounds(145, 95, 50, 20);
620 textFieldC.setBounds(210, 95, 50, 20);
621 // set bounds of end inputvaluefield
622 textFieldD.setBounds(80, 115, 50, 20);
623 textFieldE.setBounds(145,115, 50, 20);
624 textFieldF.setBounds(210, 115, 50, 20);
625 // set bounds of radiobuttonlists inputvaluefields
626 textFieldG.setBounds(220, 150, 35, 20);
627 textFieldH.setBounds(220, 175, 35, 20);
628 textFieldI.setBounds(280, 175, 35, 20);
629 textFieldJ.setBounds(220, 200, 35, 20);
630 textFieldK.setBounds(220, 225, 35, 20);
631 // set bounds of radiobuttonlist items
632 constant.setBounds(20, 150, 180, 20);
633 change.setBounds(20, 175, 200, 20);
634 scale.setBounds(20, 200, 150, 20);
635 add.setBounds(20, 225, 175, 20);
636 // set bounds of tracklist
637 trackListA.setBounds(145, 30, 120, 20);
638 // set bounds of ok and cancelbutton
639 cancelButton.setBounds(75, 265, 80, 30);
640 okButton.setBounds(195, 265, 60, 30);
645 setLocationRelativeTo(Moosique.getGUI());
649 private void makeTextDialog(Container pane, String filename) {
650 setTitle("User Manual");
651 pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
652 File manual = new File(filename);
655 BufferedReader br = new BufferedReader(new FileReader(manual));
656 char[] chars = new char[(int)manual.length()];
657 br.read(chars, 0, (int)manual.length());
658 s = new String(chars);
659 } catch (Exception ex) {
660 s = "Manual not found";
662 pane.add(new JScrollPane(new JTextArea(s, 30, 95)));
663 Action close = new AbstractAction("Close") {
664 public void actionPerformed(ActionEvent ae) {
667 JButton closeButton = new JButton(close);
668 closeButton.setAlignmentX(Component.CENTER_ALIGNMENT);
669 pane.add(closeButton);
672 setLocationRelativeTo(Moosique.getGUI());
676 private void makePrefsDialog(Container pane) {
678 MidiDevice.Info[] devInfo = MidiSystem.getMidiDeviceInfo();
679 for (int i = 0; i < devInfo.length; i++) {
680 if (MidiSystem.getMidiDevice(devInfo[i]) instanceof Sequencer) {
682 } else if (MidiSystem.getMidiDevice(devInfo[i]) instanceof Synthesizer) {
686 String[] seqNames, synthNames;
687 JPanel pane = (JPanel) this.getContentPane();
688 pane.add(new JLabel("Sequencer"));
689 JComboBox seqBox = new JComboBox(seqNames);
690 pane.add(new JLabel("Synthesizer"));
691 JComboBox synthBox = new JComboBox(synthNames);
695 private MooNote note;
696 private JOptionPane optionPane;
697 private JTextField pitch;
698 private JTextField velocity;
699 private JTextField length;
702 * Creates a new note preference dialog.
703 * @param mn the note that will be graphically represented
705 public MooDialog(MooNote mn) {
706 super(Moosique.getGUI(), "Note properties", true);
707 JPanel panel = new JPanel();
708 panel.setLayout(new GridLayout(3,2));
710 pitch = new JTextField(new Integer(note.getPitch()).toString(),3);
711 panel.add(new Label("Pitch: "));
714 velocity = new JTextField(new Integer(note.getVelocity()).toString(),3);
715 panel.add(new Label("Velocity: "));
718 length = new JTextField(new Integer(note.getDuration()).toString(),5);
719 panel.add(new Label("Length: "));
722 Object[] array = {"Set the note properties",
725 final String btnString1 = "Apply changes";
726 final String btnString2 = "Cancel";
727 Object[] options = {btnString1, btnString2};
729 optionPane = new JOptionPane(array,
730 JOptionPane.QUESTION_MESSAGE,
731 JOptionPane.YES_NO_OPTION,
735 setContentPane(optionPane);
736 setDefaultCloseOperation(DISPOSE_ON_CLOSE);
738 ActionListener intValidator = new ActionListener() {
739 public void actionPerformed(ActionEvent e) {
740 if (e.getSource() instanceof JTextField){
741 JTextField s = (JTextField)e.getSource();
742 int num = Integer.parseInt(s.getText());
745 else if (num > 127 && s != length)
747 s.setText(new Integer(num).toString());
751 pitch.addActionListener(intValidator);
752 velocity.addActionListener(intValidator);
753 length.addActionListener(intValidator);
755 optionPane.addPropertyChangeListener(new PropertyChangeListener() {
756 public void propertyChange(PropertyChangeEvent e) {
757 String prop = e.getPropertyName();
760 && (e.getSource() == optionPane)
761 && (prop.equals(JOptionPane.VALUE_PROPERTY) ||
762 prop.equals(JOptionPane.INPUT_VALUE_PROPERTY))) {
763 Object value = optionPane.getValue();
765 if (value == JOptionPane.UNINITIALIZED_VALUE) {
770 // Reset the JOptionPane's value.
771 // If you don't do this, then if the user
772 // presses the same button next time, no
773 // property change event will be fired.
775 JOptionPane.UNINITIALIZED_VALUE);
777 if (value.equals(btnString1)) {
778 note.setPitch(Integer.parseInt(pitch.getText()));
779 note.setVelocity(Integer.parseInt(velocity.getText()));
780 note.setDuration(Integer.parseInt(length.getText()));
781 Moosique.setEdited();
783 } else { // user closed dialog or clicked cancel