Clojure – Desktop Displaying Text Fields

Clojure Desktop Displaying text fields

In this guide, we will discuss Clojure Desktop Displaying Text Fields. Text Fields can be displayed with the help of the text class. An example on how this is used is shown in the following program.

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

In the above code, first a text field variable is created which is from the text class of the seesaw library. Next, the text of the text field is set to “This is a text field”. Then the text field is made a static field by setting the editable attribute to false.

When the above code is run, you will get the following window.

text fields

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply