可以在按钮类的帮助下显示按钮,以下程序显示了有关如何使用它的示例。
(ns web.core (:gen-class) (:require [seesaw.core :as seesaw])) (defn -main [& args] (defn display [content] (let [window (seesaw/frame :title "Example")] (-> window (seesaw/config! :content content) (seesaw/pack!) (seesaw/show!)))) (def button (seesaw/button :text "Click Me" :listen [:action (fn [event](seesaw/alert "Click!" ))])) (display button))
在上面的代码中,首先创建一个按钮变量,该变量来自跷seesaw的按钮类。接下来,将按钮的文本设置为" Click Me"。
然后,将事件附加到按钮,以便无论何时单击按钮,都会显示一个警报对话框。
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)