Clojure - 桌面顯示標籤



可以使用標籤類來顯示標籤。關於如何使用它的示例在下文的程式中顯示。

(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 label (seesaw/label
      :text "This is a label too"
      :background :white
      :foreground :black
      :font "ARIAL-BOLD-10"))
   (display label))

在上文的程式碼中,首先建立了一個標籤變數,該變數屬於 seesaw 庫的標籤類。接下來,將標籤文字設定為“這也算一個標籤”。然後,相應地設定背景、前景色和字型。

執行上文的程式碼時,將得到下述視窗。

Displaying Labels
clojure_applications.htm
廣告