- addWindowListener(this);
- MooInstrumentList m = new MooInstrumentList();
- getContentPane().add(m);
- m.addKeyListener(new MooKeyboard());
+
+ this.seq = seq;
+
+ Container pane = getContentPane();
+ pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
+
+ // Adds menu bar.
+ menu = new MooMenu();
+ setJMenuBar(menu);
+
+ // Adds toolbar.
+ toolbar = new MooToolbar();
+ pane.add(toolbar, BorderLayout.NORTH);
+
+ // Adds main view.
+ view = new MooView(seq.getTracks());
+ pane.add(view, BorderLayout.CENTER);
+
+ // Adds status bar.
+ statusBar = new JLabel("Welcome to Moosique!", JLabel.CENTER);
+ statusBar.setFont(FONT);
+ pane.add(statusBar, BorderLayout.SOUTH);
+
+ // Brings on the colors!
+ setBackground(pane);
+ setBackground(menu);
+ setBackground(toolbar);
+ setBackground(view);
+ statusBar.setBackground(bgColor);
+ view.setBackground(bgColor);
+
+ // Sets up global key listener
+ ActionMap am = getRootPane().getActionMap();
+
+ Action playAction = new AbstractAction() {
+ public void actionPerformed(ActionEvent ae) {
+ if (!Moosique.getSequencer().isRunning()) {
+ Moosique.play();
+ } else {
+ Moosique.stop();
+ }
+ }};
+ am.put("Play", playAction);
+
+ InputMap im = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+ KeyStroke playKey = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0);
+ im.put(playKey, "Play");
+
+ // Configures window.
+ addWindowListener(new MooGUICloser());