|
menubar() creates a menu bar. If frameOrJFrame is specified the menu bar is set to the window. list should be an array which is structured as follows.
- list ::= [menuList, ...]
- menuList ::= [title, itemList, ...]
- itemList ::= [string, function, shortcut] or [string, function]
- shortcut ::= character or KeyStroke(only with Swing)
If frameOrJFrame is JFrame object, it returns a JMenuBar object, otherwise, it returns a java.awt.MenuBar Object. To find JMenuBar class, it tries java.awt.swing.JMenuBar class first, com.sun.java.swing.JMenuBar second.
e.g.
fr = frame("title") menubar(fr, [["File", ["Open", open, 'o'], ["Save", save, 's'], ["Quit", quit, 'q']], ["Edit", ["Cut", cut, 'x'], ["Copy", copy, 'c'], ["Paste", paste, 'v']]]) fr.show()
|
menu() creates a Menu object.
e.g.
menubar = ... menubar.setHelpMenu(menu(["Help", ["About...", about]])) fr = frame("title") fr.setMenuBar(menuBar) fr.show()
|
getMenuItem() refers to a menu item which is specified by a sequence of selections.
list ::= [string, ... ]
e.g.
getMenuItem(menubar, ["File", "Open"]).setEnabled(false)