zilti / clojurefx

A Clojure JavaFX wrapper.
Eclipse Public License 1.0
58 stars 7 forks source link

(.show stg) - ClassCastException for javafx.stage.Stage #2

Closed alexandergunnarson closed 10 years ago

alexandergunnarson commented 10 years ago

_---Problem---_

After doing all the necessary require and import statements, I try to set up the root, scene, and stage like this. It worked great before the latest commit. Now there are a few errors with (.show stg) like so:

(deffx rt grid-pane
  :hgap 10
  :vgap 10
  :padding (Insets. 25 25 25 25))

-> 'user/rt

(deffx scn scene
  :width 800
  :height 600
  :root rt)

-> 'user/scn

(deffx stg stage
  :title "Testing"
  :scene scn)

-> 'user/stg

(run-now (.show stg))

-> IllegalArgumentException No matching field found: show for class java.lang.ClassCastException  clojure.lang.Reflector.getInstanceField (Reflector.java:271)

(.show stg)

-> IllegalArgumentException No matching field found: show for class java.lang.ClassCastException  clojure.lang.Reflector.getInstanceField (Reflector.java:271)

_---Source of problem---_

There are two blocks of code in the latest commits that cause this problem. The first is the Constructor Tools (clojurefx.core, line 320) block (specifically the construct and construct-node macros, methods, and multimethods). The second is the fx macro (clojurefx.core, line 377). I'm not sure how to fix this.

zilti commented 10 years ago

Tracking down symbol resolution stuff is quite nerve-wrecking, but I made it. Your code works now!