Trying to make menus in seesaw. I can't figure out what the "items" new-action open-action etc is supposed to be in the code below inside main. I thought it could be the menu item texts, or perhaps function callbacks. Ultimately it would be nice to have an example that shows how to control the menu item text, and then to be able to give the callback in my code. Don't know how to do this.
MODIFIED: This code now works correctly.
(ns hello-seesaw.core
(:gen-class)
(:use seesaw.core))
(defn handler
[event]
(alert event
(str "<html>Hello from <b>Clojure</b>. Button "
(.getActionCommand event) " clicked.")))
(defn menu-handler
[event]
()
)
(def new-action (menu-item :text "New" :listen [:action menu-handler]))
(def open-action (menu-item :text "Open" :listen [:action menu-handler]))
(def save-action (menu-item :text "Save" :listen [:action menu-handler]))
(def exit-action (menu-item :text "Exit" :listen [:action menu-handler]))
(def copy-action (menu-item :text "Copy" :listen [:action menu-handler]))
(def paste-action (menu-item :text "Paste" :listen [:action menu-handler]))
(defn -main [& args]
(invoke-later
(->
(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])
]
)
)
pack!
show!))
)