From 0c9e91d5f1f742a26c237352a4e1e7765235026c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Lanneskog?= Date: Sat, 17 May 2003 12:56:41 +0000 Subject: [PATCH] =?utf8?q?insert=20och=20delete=20measuredialogen=20=E4r?= =?utf8?q?=20fixat?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- MooDialog.java | 80 ++++++++++++++++++++++++++++++++++++++++++++++++-- MooMenu.java | 14 ++++----- 2 files changed, 84 insertions(+), 10 deletions(-) diff --git a/MooDialog.java b/MooDialog.java index 4d9d309..54d6fdf 100644 --- a/MooDialog.java +++ b/MooDialog.java @@ -22,7 +22,9 @@ public class MooDialog extends JDialog { COPY_TRACK = 3, MOVE_TRACK = 4, JUMP = 5, - CONTENTS = 6; + CONTENTS = 6, + INSERT_MEASURE = 7, + DELETE_MEASURE = 8; /** * Constructor of the dialogs. @@ -42,6 +44,8 @@ public class MooDialog extends JDialog { case MOVE_TRACK: makeMoveDialog(pane, tracks); break; case JUMP: makeJumpDialog(pane); break; case CONTENTS: makeTextDialog(pane, "Manual.txt"); break; + case INSERT_MEASURE: makeInsertMeasureDialog(pane); break; + case DELETE_MEASURE: makeDeleteMeasureDialog(pane); break; } } @@ -227,10 +231,80 @@ public class MooDialog extends JDialog { (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2); setResizable(false); pack(); - setSize(260,175); + setSize(260,165); setVisible(true); } - + + /** + * Builds the insert measure popupdialog. + * @param pane The container to put the dialog in. + */ + private void makeInsertMeasureDialog(Container pane){ + + setTitle("Insert Measure"); + labelA = new JLabel("Insert at:", JLabel.RIGHT); + pane.add(labelA); + labelB = new JLabel("Measure count:", JLabel.RIGHT); + pane.add(labelB); + textFieldA = new JTextField(); + pane.add(textFieldA); + textFieldB = new JTextField(); + pane.add(textFieldB); + cancelButton = new JButton("Cancel"); + pane.add(cancelButton); + okButton = new JButton("OK"); + pane.add(okButton); + + labelA.setBounds(20, 20, 110 ,20); + labelB.setBounds(20, 50, 110, 20); + textFieldA.setBounds(140 ,20 , 40, 20); + textFieldB.setBounds(140,50, 40, 20); + cancelButton.setBounds(20 ,95 , 80, 30); + okButton.setBounds(120, 95, 60, 30); + + setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - this.getWidth()) / 2, + (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2); + setResizable(false); + pack(); + setSize(210,175); + setVisible(true); + } + + /** + * Builds the delete measure popupdialog. + * @param pane The container to put the dialog in. + */ + private void makeDeleteMeasureDialog(Container pane) { + + setTitle("Delete Measure"); + labelA = new JLabel("Delete at:", JLabel.RIGHT); + pane.add(labelA); + labelB = new JLabel("Measure count:", JLabel.RIGHT); + pane.add(labelB); + textFieldA = new JTextField(); + pane.add(textFieldA); + textFieldB = new JTextField(); + pane.add(textFieldB); + cancelButton = new JButton("Cancel"); + pane.add(cancelButton); + okButton = new JButton("OK"); + pane.add(okButton); + + labelA.setBounds(20, 20, 110 ,20); + labelB.setBounds(20, 50, 110, 20); + textFieldA.setBounds(140 ,20 , 40, 20); + textFieldB.setBounds(140,50, 40, 20); + cancelButton.setBounds(20 ,95 , 80, 30); + okButton.setBounds(120, 95, 60, 30); + + setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - this.getWidth()) / 2, + (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2); + setResizable(false); + pack(); + setSize(210,175); + setVisible(true); + } + private void makeTextDialog(Container pane, String filename) { setTitle("Contents"); File manual = new File(filename); diff --git a/MooMenu.java b/MooMenu.java index 053030b..f4090bd 100644 --- a/MooMenu.java +++ b/MooMenu.java @@ -185,27 +185,27 @@ public class MooMenu extends JMenuBar implements ActionListener { } else if (command == "Stop") { Moosique.stop(); } else if (command == "Jump...") { - MooDialog what = new MooDialog(MooDialog.JUMP); + MooDialog newDialog = new MooDialog(MooDialog.JUMP); // Moosique.setPosition(???); Räkna ut från msr, beats, ticks, time sig. } else if (command == "Add track...") { - MooDialog what = new MooDialog(MooDialog.ADD_TRACK); + MooDialog newDialog = new MooDialog(MooDialog.ADD_TRACK); Moosique.getSequence().createTrack(); } else if (command == "Delete track...") { - MooDialog what = new MooDialog(MooDialog.DELETE_TRACK); + MooDialog newDialog = new MooDialog(MooDialog.DELETE_TRACK); /* Let the user select a track from a list. seq = Moosique.getSequence(); seq.deleteTrack(seq.getTracks()[NUMBER]); */ } else if (command == "Copy track...") { - MooDialog what = new MooDialog(MooDialog.COPY_TRACK); + MooDialog newDialog = new MooDialog(MooDialog.COPY_TRACK); } else if (command == "Move track...") { - MooDialog what = new MooDialog(MooDialog.MOVE_TRACK); + MooDialog newDialog = new MooDialog(MooDialog.MOVE_TRACK); } else if (command == "Insert measure...") { - + MooDialog newDialog = new MooDialog(MooDialog.INSERT_MEASURE); } else if (command == "Delete measure...") { - + MooDialog newDialog = new MooDialog(MooDialog.DELETE_MEASURE); } else if (command == "Set time signature...") { } else if (command == "Set tempo...") { -- 2.39.2