Last active
January 2, 2019 17:04
-
-
Save micha/a458e0b4cc8dc4d5963c30935929a92f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns hoplonfx.core | |
(:require | |
[hoplonfx.ui :refer [run]] | |
[hoplonfx.util :refer :all]) | |
(:import | |
[hoplonfx ApplicationShim] | |
[javafx.application Application])) | |
(defonce stage | |
(delay | |
(with-promise [q] | |
(Application/launch | |
ApplicationShim | |
(->> (meta (deftmp #(deliver q %))) | |
((juxt :ns :name)) | |
((conxt (comp str ns-name) str)) | |
(into-array String)))))) | |
(defn set-scene! | |
[scene] | |
@stage | |
(run (.setScene @stage scene))) | |
(defn set-title! | |
[title] | |
@stage | |
(run (.setTitle @stage title))) | |
(comment | |
(do | |
(require | |
'[hoplonfx.ui :refer :all] | |
'[javelin.core-clj :refer :all]) | |
(import | |
'[javafx.geometry Insets Pos]) | |
(defc n 0) | |
(set-title! "hello world") | |
(set-scene! | |
((Scene 800 600) | |
((StackPane) | |
((VBox) | |
:setAlignment [Pos/CENTER] | |
((Label) | |
:setPadding [(Insets. 12)] | |
:setText [(cell= (format "clicks: %d" n))]) | |
((Button) | |
:setText ["OH SHEEITT!!"] | |
:setOnAction (fn [_ _] (swap! n inc))))))) | |
) | |
) |
Author
micha
commented
Jan 2, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment