import java.awt.*;
import java.awt.event.*;
import javax.sound.midi.*;
+import java.io.*;
import java.beans.*;
-/*
+/**
* The GUI-class representing the popupdialogs in the Track menu.
*
* @author Björn Lanneskog
DELETE_TRACK = 2,
COPY_TRACK = 3,
MOVE_TRACK = 4,
- JUMP = 5;
+ JUMP = 5,
+ CONTENTS = 6;
- /*
+ /**
* Constructor of the dialogs.
*/
public MooDialog(int type) {
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
+ /**
+ * Builds the add track popupdialog.
*/
private void makeAddDialog(Container pane, Track[] tracks) {
setVisible(true);
}
- /*
- * Builds the delete track popupdialog
+ /**
+ * Builds the delete track popupdialog.
*/
private void makeDelDialog(Container pane, Track[] tracks) {
setVisible(true);
}
- /*
- * Builds the copy track popupdialog
+ /**
+ * Builds the copy track popupdialog.
*/
private void makeCopyDialog(Container pane, Track[] tracks) {
setVisible(true);
}
- /*
+ /**
* Builds the move track popupdialog
*/
private void makeMoveDialog(Container pane, Track[] tracks) {
setVisible(true);
}
- /*
- * Builds the jump popupdialog
+ /**
+ * Builds the jump popupdialog.
*/
private void makeJumpDialog(Container pane) {
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;