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
廣告