Explore and drive a running JavaFX application from its Clojure REPL.
Inspection returns live JavaFX objects. Start at a node, scene, or window; omitting the starting element inspects all open windows.
Input targets a scene or window; omitting the target requires exactly one open window. Mouse positions use scene coordinates, and keyboard input goes to the scene's focused node. The desktop pointer is not moved. Mouse input requires a showing window.
Call functions directly from the REPL; thread scheduling is handled for you. Calls finish synchronously, but application work they trigger may finish later.
Example with one open window (p is the alias used in these docstrings): (require '[cljfx.plorer :as p])
;; Inspect the window and find a text field by an ID from the tree. (def window (p/one javafx.stage.Window)) (p/tree window :depth 3 :props [:id :text]) (def field (p/one window "#name")) ; replace with your field's ID
;; Click the field's center and type hi!. (p/mouse-click! window (p/point field 0.5 0.5) :primary) (doseq [key [:h :i]] (p/key-tap! window key)) (p/key-chord! window [:shift :digit1])
;; Read the result from the live object. (p/props field :only [:text])
;; Hover over a scrollable list and scroll down. (def items (p/one window "#items")) ; replace with your list's ID (p/mouse-move! window (p/point items 0.5 0.5)) (p/scroll! window (p/point items 0.5 0.5) 0 -100)
;; Take a screenshot. (p/screenshot! window)
Explore and drive a running JavaFX application from its Clojure REPL. Inspection returns live JavaFX objects. Start at a node, scene, or window; omitting the starting element inspects all open windows. Input targets a scene or window; omitting the target requires exactly one open window. Mouse positions use scene coordinates, and keyboard input goes to the scene's focused node. The desktop pointer is not moved. Mouse input requires a showing window. Call functions directly from the REPL; thread scheduling is handled for you. Calls finish synchronously, but application work they trigger may finish later. Example with one open window (p is the alias used in these docstrings): (require '[cljfx.plorer :as p]) ;; Inspect the window and find a text field by an ID from the tree. (def window (p/one javafx.stage.Window)) (p/tree window :depth 3 :props [:id :text]) (def field (p/one window "#name")) ; replace with your field's ID ;; Click the field's center and type hi!. (p/mouse-click! window (p/point field 0.5 0.5) :primary) (doseq [key [:h :i]] (p/key-tap! window key)) (p/key-chord! window [:shift :digit1]) ;; Read the result from the live object. (p/props field :only [:text]) ;; Hover over a scrollable list and scroll down. (def items (p/one window "#items")) ; replace with your list's ID (p/mouse-move! window (p/point items 0.5 0.5)) (p/scroll! window (p/point items 0.5 0.5) 0 -100) ;; Take a screenshot. (p/screenshot! window)
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |