目录

Desktop – Displaying Labels

可以在标签类的帮助下显示标签。 以下程序显示了如何使用它的示例。

(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))

在上面的代码中,首先创建一个标签变量,该变量来自跷跷板库的标签类。 接下来,标签的文本设置为“这也是标签”。 然后,相应地设置背景,前景色和字体。

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

显示标签
↑回到顶部↑
WIKI教程 @2018