- // Dimension bounds = new Dimension(300,70);
- // setSize(bounds.width,bounds.height);
- // setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (bounds.width / 2), (Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (bounds.height / 2));
+ // Creates timer.
+ timer = new java.util.Timer();
+
+ // 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();
+ setIconImage(Toolkit.getDefaultToolkit().getImage("images/moose.gif"));
+ Dimension bounds = Toolkit.getDefaultToolkit().getScreenSize();
+ setSize(bounds.width,bounds.height - 40);
+ setLocation(0, 0);