跷跷板是一个可用于创建桌面应用程序的库。为了使用跷跷板,请首先从以下github链接下载.clj文件:https://github.com/daveray/seesaw

然后创建一个示例桌面应用程序。以下是相同的代码。

(ns web.core
   (:gen-class)
   (:require [seesaw.core :as seesaw]))
(def window (seesaw/frame
   :title "First Example"
   :content "hello world"
   :width 200
   :height 50))
(defn -main
   [& args]
   (seesaw/show! window))

当上面的代码运行时,您将获得以下窗口。

Hello World

该代码非常不言自明。

  • 首先,您需要确保使用 seesaw.core 库,以便可以使用所有可用的方法。

  • 框架和内容的属性可用于定义标题和需要在窗口中显示的内容。

  • 最后,"显示!" 函数用于显示窗口。

参考链接

https://www.learnfk.com/clojure/clojure-desktop-seesaw.html