【问题标题】:How to set an image for the panel background with seesaw?如何使用跷跷板为面板背景设置图像?
【发布时间】:2013-07-11 21:10:37
【问题描述】:

我想在我的 clojure 应用程序中为面板背景设置自定义图像。使用跷跷板我可以为背景设置一些颜色:

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

但是如何使用它的 url 来选择图片呢?

【问题讨论】:

    标签: image user-interface background clojure seesaw


    【解决方案1】:

    Seesaw 允许您通过 icon function(现在在 seesaw.icon)将图像用于 frame 内容,如下所示:

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

    其中img_bgFileURL 等。但是,查看Seesaw 代码,我看不到通过Seesaw API 将背景图像直接放在面板中的方法。您可能必须下拉到 Java 互操作并直接使用 Swing API。 This SO question 建议这是可能的,并且可以帮助您入门。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-31
      • 2014-03-18
      • 1970-01-01
      • 1970-01-01
      • 2014-03-06
      • 2018-01-30
      相关资源
      最近更新 更多