Clojure Desktop Displaying Text Fields
2018-12-29 17:55 更新
文本字段可以在文本类的帮助下显示。 下面的程序显示了如何使用它的示例。
(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,将文本字段设置为静态字段。
当上面的代码运行时,你会得到以下窗口。

以上内容是否对您有帮助:

免费 AI IDE


更多建议: