Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set an image for the panel background with seesaw?

I want to set a custom image for the panel background in my clojure app. Using seesaw I can set some color for the background:

(defn make-panel []
      (border-panel
        :north (flow-panel :align :center
                           :items [(label :text "TEXT")])
        :center (canvas :class :board
                        :background :black)
        :border 5))

but how to choose an image using its url?

like image 555
mimikrmvr Avatar asked Oct 21 '22 05:10

mimikrmvr


1 Answers

Seesaw lets you use an image for frame content, via the icon function (now in seesaw.icon), like so:

(frame :title "Hola!"
       ; ....
       :content (label :icon img_bg)

where img_bg is a File, URL, etc. However, looking at the Seesaw code, I don't see a way to put a background image directly in a panel through the Seesaw API. You may have to drop down to Java interop and use the Swing API directly. This SO question would suggest that it's possible, and may get you started.

like image 169
JohnJ Avatar answered Oct 25 '22 18:10

JohnJ