X-Git-Url: https://ruin.nu/git/?p=moosique.git;a=blobdiff_plain;f=MooDialog.java;h=4d9d309dbdde294ed612afa7f98102eddeb48ec1;hp=82305788c5220b897c4c1ca8e33db5ac0b3cd2d8;hb=c3a31c2aa833e2197f0929655c69a2090e8bbecc;hpb=83c3edf41adc9a5ae904331bc230fc1536fdeeb4 diff --git a/MooDialog.java b/MooDialog.java index 8230578..4d9d309 100644 --- a/MooDialog.java +++ b/MooDialog.java @@ -2,6 +2,7 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.sound.midi.*; +import java.io.*; import java.beans.*; /** @@ -20,7 +21,8 @@ public class MooDialog extends JDialog { DELETE_TRACK = 2, COPY_TRACK = 3, MOVE_TRACK = 4, - JUMP = 5; + JUMP = 5, + CONTENTS = 6; /** * Constructor of the dialogs. @@ -34,40 +36,19 @@ public class MooDialog extends JDialog { Track[] tracks = Moosique.getSequence().getTracks(); switch (type) { - case ADD_TRACK: - - makeAddDialog(pane, tracks); - - break; - - case DELETE_TRACK: - - makeDelDialog(pane, tracks); - - break; - - case COPY_TRACK: - - makeCopyDialog(pane, tracks); - - break; - - case MOVE_TRACK: - - makeMoveDialog(pane, tracks); - - break; - - case JUMP: - - makeJumpDialog(pane); - - break; + case ADD_TRACK: makeAddDialog(pane, tracks); break; + case DELETE_TRACK: makeDelDialog(pane, tracks); break; + case COPY_TRACK: makeCopyDialog(pane, tracks); break; + case MOVE_TRACK: makeMoveDialog(pane, tracks); break; + case JUMP: makeJumpDialog(pane); break; + case CONTENTS: makeTextDialog(pane, "Manual.txt"); break; } } /** * Builds the add track popupdialog. + * @param pane The container to put the dialog in. + * @param tracks A array containing miditracks. */ private void makeAddDialog(Container pane, Track[] tracks) { @@ -103,6 +84,8 @@ public class MooDialog extends JDialog { /** * Builds the delete track popupdialog. + * @param pane The container to put the dialog in. + * @param tracks A array containing miditracks. */ private void makeDelDialog(Container pane, Track[] tracks) { @@ -132,6 +115,8 @@ public class MooDialog extends JDialog { /** * Builds the copy track popupdialog. + * @param pane The container to put the dialog in. + * @param tracks A array containing miditracks. */ private void makeCopyDialog(Container pane, Track[] tracks) { @@ -168,6 +153,8 @@ public class MooDialog extends JDialog { /** * Builds the move track popupdialog + * @param pane The container to put the dialog in. + * @param tracks A array containing miditracks. */ private void makeMoveDialog(Container pane, Track[] tracks) { @@ -204,6 +191,8 @@ public class MooDialog extends JDialog { /** * Builds the jump popupdialog. + * @param pane The container to put the dialog in. + * @param tracks A array containing miditracks. */ private void makeJumpDialog(Container pane) { @@ -241,7 +230,31 @@ public class MooDialog extends JDialog { setSize(260,175); setVisible(true); } - + + private void makeTextDialog(Container pane, String filename) { + setTitle("Contents"); + File manual = new File(filename); + String s; + try { + BufferedReader br = new BufferedReader(new FileReader(manual)); + char[] chars = new char[(int)manual.length()]; + br.read(chars, 0, (int)manual.length()); + s = new String(chars); + } catch (Exception ex) { + s = "Manual not found"; + } + JTextArea contents = new JTextArea(s, 30, 40); + contents.setAutoscrolls(true); + pane.add(contents); + contents.setBounds(10, 10, 500, 350); + setResizable(false); + pack(); + setSize(600,400); + setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - this.getWidth()) / 2, + (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2); + setVisible(true); + } + private MooNote note; private JOptionPane optionPane; private JTextField pitch;