]> ruin.nu Git - moosique.git/blob - MooGUI.java
no message
[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         private Sequence seq;
15         private JLabel statusBar;
16         // private MooView view;
17         
18         /** 
19          * Creates the GUI.
20          */
21         public MooGUI(Sequence seq) {
22                 super("Moosique");
23
24                 // Adds menu bar.
25                 setJMenuBar(new MooMenu());
26
27                 // Adds toolbar.
28                 getContentPane().add(new MooToolbar(), BorderLayout.NORTH);
29                 addWindowListener(this);
30                 
31                 // Adds main view.
32                 // view = new MooView();
33
34                 // Adds status bar.
35                 statusBar = new JLabel("Welcome to Moosique!", Label.CENTER);
36
37                 MooInstrumentList m = new MooInstrumentList();
38                 getContentPane().add(m, BorderLayout.CENTER);
39                 m.addKeyListener(new MooKeyboard());
40                 pack();
41
42                 // Dimension bounds = new Dimension(300,70);
43                 // setSize(bounds.width,bounds.height);
44                 // setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (bounds.width / 2), (Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (bounds.height / 2));
45                 // setResizable(false);
46                 // setBackground(Color.white);
47                 setVisible(true);
48         }
49         
50         /** 
51          * Changes the sequence of the GUI.
52          * @param sequence      the MIDI sequence to visualize
53          */
54         public void setSequence(Sequence sequence) {
55                 seq = sequence;
56         }
57
58         /** 
59          * Shows the given message in the status bar.
60          * @param text  the message to show
61          */
62         public void setStatus(String text) {
63                 statusBar.setText(text);
64         }
65
66         public void windowOpened(WindowEvent e) {}
67         public void windowClosing(WindowEvent e) {Moosique.quit();}
68         public void windowClosed(WindowEvent e) {}
69         public void windowIconified(WindowEvent e) {}
70         public void windowDeiconified(WindowEvent e) {}
71         public void windowActivated(WindowEvent e) {}
72         public void windowDeactivated(WindowEvent e) {}
73 }