X-Git-Url: https://ruin.nu/git/?p=moosique.git;a=blobdiff_plain;f=MooMenu.java;h=f51af1a28de19f14c5234bae9dd3f879eb2d7cc0;hp=5d8dd36c6f7e0dd78b6e24d6130563ef73daaf3b;hb=83c3edf41adc9a5ae904331bc230fc1536fdeeb4;hpb=e8ff555b11770392c98b881d317d3297305733d6 diff --git a/MooMenu.java b/MooMenu.java index 5d8dd36..f51af1a 100644 --- a/MooMenu.java +++ b/MooMenu.java @@ -71,13 +71,24 @@ public class MooMenu extends JMenuBar implements ActionListener { addItem(help, "Getting started"); addItem(help, "About"); } - + /** + * Creats a menu in the menubar. + * @param name The name of the menu. + * @param mnemnic The shortcut-key to access the menu. + * @return menu The menu created. + */ private JMenu createMenu(String name, int mnemonic) { JMenu menu = new JMenu(name); menu.setMnemonic(mnemonic); return menu; } + /** + * Creats a menuitem in the menu. + * @param menu The menu where to add the menuitem. + * @param name The name of the menuitem. + * @return item The menuitem created. + */ private JMenuItem addItem(JMenu menu, String name) { JMenuItem item = new JMenuItem(name); item.addActionListener(this); @@ -85,6 +96,13 @@ public class MooMenu extends JMenuBar implements ActionListener { return item; } + /** + * Creats a menuitem in the menu. + * @param menu The menu to where to add the menuitem. + * @param name The name of the menuitem. + * @param key The keystroke to access this menuitem. + * @return item The menuitem created. + */ private JMenuItem addItem(JMenu menu, String name, String key) { JMenuItem item = new JMenuItem(name); item.setAccelerator(KeyStroke.getKeyStroke(key)); @@ -93,6 +111,14 @@ public class MooMenu extends JMenuBar implements ActionListener { return item; } + /** + * Creats a menuitem in the menu. + * @param menu The menu to where to add the menuitem. + * @param name The name of the menuitem. + * @param key The keystroke to access this menuitem. + * @param mask The keyboard mask. + * @return item The menuitem created. + */ private JMenuItem addItem(JMenu menu, String name, int key, int mask) { JMenuItem item = new JMenuItem(name); item.setAccelerator(KeyStroke.getKeyStroke(key, mask)); @@ -108,7 +134,10 @@ public class MooMenu extends JMenuBar implements ActionListener { } return false; } - + /** + * Gets the users command of takes and properiate action + * @param e the action perfomed + */ public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); Sequence seq; @@ -204,15 +233,15 @@ public class MooMenu extends JMenuBar implements ActionListener { } else if (command == "Transpose...") { } else if (command == "Contents") { - // contents to be filled in + JOptionPane.showMessageDialog(this, "här kommer contents komma"); } else if (command == "Getting started") { - // getting started to be filled in + JOptionPane.showMessageDialog(null, "här kommer getting started komma"); } else if (command == "About") { - // about to be filled in + JOptionPane.showMessageDialog(null, "här kommer about att komma"); } }