]> ruin.nu Git - moosique.git/blobdiff - MooMenu.java
Updated command-line handling in Moosique,
[moosique.git] / MooMenu.java
index f206457799c4a1d0fb1565c391ee585abb47d50b..86f95008ff25853821e90ebf5285b466109be6dd 100644 (file)
@@ -15,6 +15,47 @@ public class MooMenu extends JMenuBar implements ActionListener
                add(createHelpMenu());
        }
 
+/*     
+       Ett något smidigare sätt, kanske.. / EP
+       
+       public MooMenu() {
+               file = makeMenu("File", KeyEvent.VK_F);
+               add(file)
+               // Samma sak med de andra menyerna
+               
+               file.add(makeAccItem(file, "New", KeyEvent.VK_N);
+               // Samma sak med de andra menyalternativen
+       }
+
+       private JMenu makeMenu(String name, int mnemonic) {
+               JMenu menu = new JMenu(name);
+               menu.setMnemonic(mnemonic);
+       }
+
+       private JMenuItem makeItem(JMenu menu, String name) {
+               JMenuItem item = new JMenuItem(name);
+               item.addActionListener(this);
+               menu.add(item);
+       }
+
+       private JMenuItem makeAccItem(JMenu menu, String name, int key) {
+               JMenuItem item = new JMenuItem(name);
+               item.setAccelerator(KeyStroke.getKeyStroke(key, ActionEvent.CTRL_MASK));
+               item.addActionListener(this);
+               menu.add(item);
+       }
+       
+       public void actionPerformed(ActionEvent e) {
+               String command = e.getActionCommand();
+               ...
+               if(command == "Play") {
+                       
+               } else if (command == "Stop") {
+                       
+               } // Osv.
+       }
+*/
+
        // creates the filemenu
        private JMenu createFileMenu()
        {
@@ -102,7 +143,7 @@ public class MooMenu extends JMenuBar implements ActionListener
        private JMenu createHelpMenu()
        {
                help = new JMenu("Help");
-               help.setMnemonic(KeyEvent.VK_P);
+               help.setMnemonic(KeyEvent.VK_H);
                
                contents = new JMenuItem("Contents");
                help.add(contents);