]> ruin.nu Git - moosique.git/blob - MooGUI.java
Fixed the FileFilter, implemented some menu options, tweaked the GUI and organized...
[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 one track.
32                 getContentPane().add(new MooTrackView(), BorderLayout.CENTER);
33                 addWindowListener(this);
34                 
35                 // Adds main view.
36                 // view = new MooView();
37
38                 // Adds status bar.
39                 statusBar = new JLabel("Welcome to Moosique!", JLabel.CENTER);
40                 getContentPane().add(statusBar, BorderLayout.SOUTH);
41
42                 pack();
43                 Dimension bounds = new Dimension(400,300);
44                 setSize(bounds.width,bounds.height);
45                 setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (bounds.width / 2), (Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (bounds.height / 2));
46                 // setResizable(false);
47                 // setBackground(Color.white);
48                 setVisible(true);
49                 show();
50         }
51         
52         /** 
53          * Changes the sequence of the GUI.
54          * @param sequence      the MIDI sequence to visualize
55          */
56         public void setSequence(Sequence sequence) {
57                 seq = sequence;
58         }
59
60         /** 
61          * Shows the given message in the status bar.
62          * @param text  the message to show
63          */
64         public void setStatus(String text) {
65                 statusBar.setText(text);
66         }
67
68         public void windowOpened(WindowEvent e) {}
69         public void windowClosing(WindowEvent e) {Moosique.quit();}
70         public void windowClosed(WindowEvent e) {}
71         public void windowIconified(WindowEvent e) {}
72         public void windowDeiconified(WindowEvent e) {}
73         public void windowActivated(WindowEvent e) {}
74         public void windowDeactivated(WindowEvent e) {}
75 }