Clojure - Desktop Displaying Labels

Labels can be displayed with the help of the label class. An example on how this is used is shown in the following program.

(ns web.core
   (:require [seesaw.core :as seesaw]))
(defn -main [& args]
   (defn display
      (let [window (seesaw/frame :title "Example")]
         (-> window
            (seesaw/config! :content content)
   (def label (seesaw/label
      :text "This is a label too"
      :background :white
      :foreground :black
      :font "ARIAL-BOLD-10"))
   (display label))

In the above code, first a label variable is created which is from the label class of the seesaw library. Next, the text of the label is set to "This is a label too". Then, the background, foreground color, and font are set accordingly.

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

Displaying Labels
Kickstart Your Career

Get certified by completing the course

Get Started