Each of the *-action
items refer to a kind of menu item (menu-item
, checkbox-menu-item
, or radio-menu-item
). Each of these has the same options as button
, so you configure each one like you do the button in your first frame.
Your definition for the new button might look like:
(def new-action (menu-item :text "New" :listen [:action handler]))
As an aside, if you try to run the program as written with both frames defined, you will get an IllegalArgumentException
(because you are passing the result of the first frame call to the second). An easy solution is to combine the two.
(frame :title "Hello Swing" :on-close :exit
:content (button :text "Click Me" :listen [:action handler])
:menubar
(menubar :items
[(menu :text "File" :items [new-action open-action save-action exit-action])
(menu :text "Edit" :items [copy-action paste-action])]))