Clojure - 桌面跷跷板



See-saw 是一个可用于创建桌面应用程序的库。要使用 See-saw,首先从以下 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** 库,以便可以使用所有可用方法。

  • frame 和 content 的属性可用于定义标题以及在窗口中需要显示的内容。

  • 最后,使用 **‘show!’** 函数显示窗口。

clojure_applications.htm
广告

© . All rights reserved.