]> ruin.nu Git - moosique.git/blob - MooGUI.java
added MooMenu.java and lade till setJMenuBar i MooGui's constructor
[moosique.git] / MooGUI.java
1 import javax.sound.midi.*;
2 import javax.swing.*;
3 import java.awt.*;
4 import java.awt.event.*;
5
6 /**
7  * Moosique's graphical user interface.
8  * 
9  * @author  Mikael Andreen
10  */
11  
12 public class MooGUI extends JFrame implements WindowListener {
13
14         Sequence seq;
15         
16         /** 
17          * Creates the GUI.
18          */
19         public MooGUI(Sequence seq) {
20                 super("Moosique");
21                 addWindowListener(this);
22                 MooInstrumentList m = new MooInstrumentList();
23                 getContentPane().add(m);
24                 m.addKeyListener(new MooKeyboard());
25                 pack();
26                 Dimension bounds = new Dimension(300,70);
27                 setJMenuBar(new MooMenu());
28 //              setSize(bounds.width,bounds.height);
29                 setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (bounds.width / 2), (Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (bounds.height / 2));
30 //              setResizable(false);
31                 setBackground(Color.white);
32                 setVisible(true);
33         }
34         
35         /** 
36          * Changes the sequence of the GUI.
37          * @param sequence      the MIDI sequence to visualize
38          */
39         public void setSequence(Sequence sequence) {
40                 seq = sequence;
41         }
42
43         public void windowOpened(WindowEvent e) {}
44         public void windowClosing(WindowEvent e) {Moosique.quit();}
45         public void windowClosed(WindowEvent e) {}
46         public void windowIconified(WindowEvent e) {}
47         public void windowDeiconified(WindowEvent e) {}
48         public void windowActivated(WindowEvent e) {}
49         public void windowDeactivated(WindowEvent e) {}
50 }