目录

Desktop – Displaying Text Fields

可以在文本类的帮助下显示文本字段。 以下程序显示了如何使用它的示例。

(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 textfield
      (seesaw/text
         :text "This is a text field"
         :editable? false
         :columns 50))
   (display textfield))

在上面的代码中,首先创建一个文本字段变量,该变量来自跷跷板库的文本类。 接下来,文本字段的文本被设置为“这是一个文本字段”。 然后通过将editable属性设置为false,将文本字段设置为静态字段。

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

文本域
↑回到顶部↑
WIKI教程 @2018