X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooGUI.java;h=490026440350483e48b0f7bfd0aac2a4ab8afeba;hb=f520dce96c76f627677c5d9957e8371d02a31ec0;hp=4c008f4d2e500504b09d2c11111deb3101488bb0;hpb=c87df9f217c5730ae465252b415bb7e52a4f3fed;p=moosique.git diff --git a/MooGUI.java b/MooGUI.java index 4c008f4..4900264 100644 --- a/MooGUI.java +++ b/MooGUI.java @@ -21,6 +21,7 @@ public class MooGUI extends JFrame { public static final int statusResetDelay = 3000; public static final Font FONT = new Font("Helvetica", Font.PLAIN, 10); public static final Color bgColor = new Color(192, 224, 255); + public static final Image logo = Toolkit.getDefaultToolkit().getImage("images/moose.gif"); /** * Creates the GUI. @@ -59,8 +60,6 @@ public class MooGUI extends JFrame { setBackground(menu); setBackground(toolbar); setBackground(view); - statusBar.setBackground(bgColor); - view.setBackground(bgColor); // Creates timer. timer = new java.util.Timer(); @@ -77,30 +76,24 @@ public class MooGUI extends JFrame { } }}; am.put("Play", playAction); - am.put("Octave change 2", createOctaveAction(2)); - am.put("Octave change 4", createOctaveAction(4)); - am.put("Octave change 6", createOctaveAction(6)); - am.put("Octave change 8", createOctaveAction(8)); + am.put("Change octave up", createOctaveAction(true)); + am.put("Change octave down", createOctaveAction(false)); InputMap im = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); KeyStroke playKey = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0); - KeyStroke octave2Key = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0); - KeyStroke octave4Key = KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0); - KeyStroke octave6Key = KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0); - KeyStroke octave8Key = KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0); + KeyStroke octaveUpKey = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0); + KeyStroke octaveDownKey = KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0); im.put(playKey, "Play"); - im.put(octave2Key, "Octave change 2"); - im.put(octave4Key, "Octave change 4"); - im.put(octave6Key, "Octave change 6"); - im.put(octave8Key, "Octave change 8"); + im.put(octaveUpKey, "Change octave up"); + im.put(octaveDownKey, "Change octave down"); advanceStatus(); // Configures window. addWindowListener(new MooGUICloser()); pack(); - setIconImage(Toolkit.getDefaultToolkit().getImage("images/moose.gif")); + setIconImage(logo); Dimension bounds = Toolkit.getDefaultToolkit().getScreenSize(); - setSize(bounds.width,bounds.height - 40); + setSize(bounds.width,bounds.height - 28); setLocation(0, 0); setBackground(Color.white); advanceStatus(); @@ -150,12 +143,12 @@ public class MooGUI extends JFrame { /** * Creates an action for a specific octave. - * @param octave The octave we want an action for. + * @param increase true for increase, false for decrease */ - private Action createOctaveAction(final int octave) { + private Action createOctaveAction(final boolean increase) { Action octaveAction = new AbstractAction() { public void actionPerformed(ActionEvent ae) { - MooKeyboard.setOctave(octave); + MooKeyboard.setRelativeOctave(increase); }}; return octaveAction; }