Created
January 5, 2019 01:13
-
-
Save micha/08dec9377f91d600ca3ac0c402093fe1 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.demo.app | |
(:require | |
[hoplonfx.ui :as ui] | |
[hoplonfx.cell :refer :all]) | |
(:refer hoplonfx.ui :rename {cell fxcell}) | |
(:import [javafx.geometry Insets Pos] | |
[com.jfoenix.controls JFXButton])) | |
(defn jfx-button | |
[& args] | |
(apply make-node JFXButton args)) | |
(defn -add-stylesheet | |
[url] | |
(fn [x] (-> x .-root .getStylesheets (.add url)))) | |
(defonce n (cell 0)) | |
(defn -main [& _] | |
(with-primary-stage | |
(set-title! "hello world") | |
(set-scene! | |
((scene 250 200) | |
(-add-stylesheet "/css/jfoenix-design.css") | |
(-add-stylesheet "/css/jfoenix-fonts.css") | |
((stack-pane) | |
(-set-style "-fx-background-color: WHITE;") | |
((v-box) | |
(-set-alignment Pos/CENTER) | |
((label) | |
#_(-set-padding (Insets. 12)) | |
(-set-style "-fx-font-size: 120px;") | |
(-set-text (cell= (format "%d" n)))) | |
((jfx-button) | |
(-set-text (cell= (format "click to make it %d" (inc n)))) | |
(-set-style "-fx-padding: 0.7em 0.57em; | |
-fx-font-size: 14.0px; | |
-jfx-button-type: RAISED; | |
-fx-background-color: rgb(102.0, 153.0, 102.0); | |
-fx-pref-width: 200.0; | |
-fx-text-fill: WHITE; | |
") | |
(-set-on-action (h [_ _] (swap! n inc)))))))))) | |
(comment | |
(reset! n 0) | |
(-main) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment