In this guide, we will discuss Clojure Desktop Displaying Buttons. Buttons can be displayed with the help of the button 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 button (seesaw/button :text "Click Me" :listen [:action (fn [event](seesaw/alert "Click!" ))])) (display button))
In the above code, first a button variable is created which is from the button class of the see-saw library. Next, the text of the button is set to “Click Me”. Then an event is attached to the button so that whenever the button is clicked, it will show an alert dialog box.
When the above code is run, you will get the following window.
When you click the button, you will get the following dialog box.
Next Topic : Click Here
Pingback: Desktop Displaying a Modal Dialog Box | Adglob Infosystem Pvt Ltd
Pingback: Clojure - Applications | Adglob Infosystem Pvt Ltd