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());
pack();
comps[i].setBackground(bgColor);
}
}
-
+
/**
* Changes the sequence of the GUI.
* @param sequence the MIDI sequence to visualize
*/
public void setSequence(Sequence sequence) {
seq = sequence;
- view.update(seq.getTracks());
+ view.setTracks(seq.getTracks());
}
/**
public void setStatus(String text) {
statusBar.setText(text);
}
-
+
+ /**
+ * Calls on the main view to update the track views,
+ * and on the toolbar to update the progress indicator.
+ */
+ public void update(){
+ view.update();
+ toolbar.updateProgInd();
+ }
+
class MooGUICloser extends WindowAdapter {
public void windowClosing(WindowEvent e) {
Moosique.quit();
}
}
-}
\ No newline at end of file
+}