Although it's not obvious from the JavaFX docs since they're written for a Java audience, it is very possible to create apps in an interactive style without inheritance. Two caveats:
* Ignore the Application class. Just create your scene, etc directly. * Most execution has to run on the JavaFX thread so everything you do has to be wrapped in an "invoke-now" that dispatches the code to that thread and waits for the result. Swing is much more forgiving on this front at the expense of allowing a lot of badly threaded code to be written. I've captured some of this stuff in upshot (https://github.com/daveray/upshot) which is on hiatus at the moment but kind of works at least. There's an example here [1] without an Application or inheritance in sight. Cheers, Dave [1] https://github.com/daveray/upshot/blob/develop/test/upshot/test/examples/example.clj On Wed, Dec 5, 2012 at 4:08 PM, Stephen Compall <stephen.comp...@gmail.com> wrote: > On Dec 5, 2012 6:38 PM, "Christian Sperandio" > <christian.speran...@gmail.com> wrote: >> And I find that the Clojure code is damaged by the JavaFX inheritance. You >> must write :gen-class extends to just display a window. > > There are many things in JavaFX for which documentation suggests > subclassing, but it is entirely reasonable to simply instantiate and call > methods. Keep the API docs handy; they are your friend. > > Even if occasionally you run into BuilderFactory or ill-typed lambda > representations. > >> And when I read documentation about bindings, I thought it was complicated >> to make a simple thing (look at watch in clojure). OK, the JavaFX bindings >> work but I feel writing code for writing code. > > Fortunately, Clojure has good tools for writing code for writing code. > >> My second bad point for JavaFX, it's about the interactive development. I >> love languages like Groovy and Clojure because you can test the code in a >> console (GroovyConsole or REPL). Can we do that with JavaFX? > > Yes, absolutely. > >> My main problem is the following: for launching of your JavaFX >> application, you have to call the start method in your main. > > Spawning a thread to run start is as easy as (future (.start ...)) in > clojure. Futures are GC-rooted in Clojure, so you can forget the future if > you want. > >> It blocks the current thread and the REPL waits for closing the window. > > Again, the documented approach is not always best; the API provides tools > for customizing initialization. > >> When I read code like callback<TableColumn<Person, String>,XXX<YYYY>>, >> sorry but I'm discouraged. > > JavaFX's big problem is that it doesn't use *enough* type parameters, > really. > > I won't call myself a "fan" of JFX, though, because as I recall the > implementation is not yet entirely Free, though most of it is available > under GPL. If I am wrong, though, I encourage you to explore it further. > > -- > Stephen Compall > If anyone in the MSA is online, you should watch this flythrough. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en