# mistlibs.fx-clj **Repository Path**: ellipse/mistlibs.fx-clj ## Basic Information - **Project Name**: mistlibs.fx-clj - **Description**: A Clojure library for JavaFX based on fx-clj. - **Primary Language**: Clojure - **License**: EPL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2016-01-03 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: desktop-ui **Tags**: None ## README **[Guide](http://documentup.com/aaronc/fx-clj)** | **[API docs](http://aaronc.github.io/fx-clj/)** | **[Source](http://github.com/aaronc/fx-clj)** | **[CHANGELOG](https://github.com/aaronc/fx-clj/releases)** | **[License](https://raw.githubusercontent.com/aaronc/fx-clj/master/LICENSE)** [![Clojars Project](http://clojars.org/fx-clj/latest-version.svg)](http://clojars.org/fx-clj) Beta quality - the API is pretty stable and has gotten a fair amount of testing. JDK 8 and at least Clojure 1.7.0-alpha3 are required. ## Overview A Clojure library for JavaFX 8 with the following goals: - Provide convenience functions for creating and modifying JavaFX objects without attempting to completely hide the JavaFX API - Work with **core.async** out of the box - Provide support for creating JavaFX objects with both a function based - `(fx/h-box (fx/button "Hello World"))` - and **hiccup-like** API - `(fx/compile-fx [:h-box [:button "Hello World"]])`. - Provide an API for modifying nodes with selectors (sort of like enlive) **for interacting with FXML resources** - Allow for setting JavaFX CSS from code and integrate with the **garden CSS** library - Helper functions for **i18n** - Provide **data binding to reactive atoms, cursors and expressions** (via [freactive.core](https://github.com/aaronc/freactive.core)). ## Quick Start Make sure you have installed [JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) and have lein configured to use it. See the leiningen [sample.project.clj](https://github.com/technomancy/leiningen/blob/master/sample.project.clj) and search for `LEIN_JAVA_CMD`, `:java-cmd` and `JAVA_CMD` to see different ways to do this. Add the leiningen dependency to your project listed above and a namespace declaration similar to the following to your code: ```clojure (ns my-ns (:require [fx-clj.core :as fx])) ``` A "hello world" example: ```clojure (ns example (:require [fx-clj.core :as fx])) (defn create-view [] (fx/h-box (fx/button {:on-action (fn [e] (println "Hello World!")) :text "Click Me!"}))) (fx/sandbox #'create-view) ;; Creates a "sandbox" JavaFX window to ;; show the view. Clicking F5 in this ;; window will refresh the view allowing the ;; create-view function to be updated at the REPL ``` A quick example for integrating `fx-clj` and `core.async`: ```clojure (ns example2 (:require [fx-clj.core :as fx]) (:require [clojure.core.async :refer [chan go !]])) (defn create-view [] (let [click-ch (chan) btn (fx/button :#my-btn {:on-action click-ch ;; You can bind a core.async channel directly to an event :text "Next"}) txt (fx/text "Initial text") view (fx/v-box txt btn)] (go (