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 库的标签类的标签变量。 接下来,标签的文本设置为"This is a label too"。 然后,相应地设置背景、前景色和字体。

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

显示标签

❮ clojure_applications.html