Clojure-desktop-displaying-labels

提供:Dev Guides
移動先:案内検索

Clojure-デスクトップ表示ラベル

ラベルは、ラベルクラスを使用して表示できます。 これがどのように使用されるかの例は、次のプログラムに示されています。

(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))

上記のコードでは、最初にシーソーライブラリのラベルクラスからのラベル変数が作成されます。 次に、ラベルのテキストが「これもラベルです」に設定されます。 次に、背景、前景色、およびフォントがそれに応じて設定されます。

上記のコードを実行すると、次のウィンドウが表示されます。

ラベルの表示