文本字段可以在文本類的幫助下顯示。 下面的程序顯示了如何使用它的示例。
(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))
在上面的代碼中,首先創(chuàng)建一個(gè)文本字段變量,它來自于翹板庫的文本類。 接下來,文本字段的文本設(shè)置為“這是文本字段”。 然后通過將editable屬性設(shè)置為false,將文本字段設(shè)置為靜態(tài)字段。
當(dāng)上面的代碼運(yùn)行時(shí),你會得到以下窗口。
更多建議: