Clojure - Desktop Displaying Labels


Advertisements

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
   (: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 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
clojure_applications.htm
Advertisements