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

在上面的代碼中,首先創(chuàng)建一個文本字段變量,它來自于翹板庫的文本類。 接下來,文本字段的文本設置為“這是文本字段”。 然后通過將editable屬性設置為false,將文本字段設置為靜態(tài)字段。

當上面的代碼運行時,你會得到以下窗口。

Text Field

以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號