forked from cljfx/cljfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe10_multiple_windows.clj
58 lines (52 loc) · 1.29 KB
/
e10_multiple_windows.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(ns e10-multiple-windows
(:require [cljfx.api :as fx])
(:import [javafx.stage Screen]))
(defn window [{:keys [x y width height]}]
{:fx/type :stage
:always-on-top true
:showing true
:x x
:y y
:width width
:height height
:scene {:fx/type :scene
:root {:fx/type :v-box
:alignment :center
:children [{:fx/type :label
:text (str "Window at [" x ", " y "] "
"with size " width "x" height)}]}}})
(def width 300)
(def height 100)
(def bottom
(-> (Screen/getPrimary)
.getBounds
.getHeight
(- height)))
(def right
(-> (Screen/getPrimary)
.getBounds
.getWidth
(- width)))
(fx/on-fx-thread
(fx/create-component
{:fx/type fx/ext-many
:desc [{:fx/type window
:x 0
:y 0
:width width
:height height}
{:fx/type window
:x 0
:y bottom
:width width
:height height}
{:fx/type window
:x right
:y 0
:width width
:height height}
{:fx/type window
:x right
:y bottom
:width width
:height height}]}))