JavaFX copy from clojure

I started learning clojure, and I wanted to try JavaFX for GUI I found this article: http://nailthatbug.net/2011/06/clojure-javafx-2-0-simple-app/

So, for example, I can write this and look at the new window:

(defn main-start []
  (doto (JFrame. "Window!")
   (.setSize (java.awt.Dimension. 400 300))
   (.setVisible true)))

There is no way to do such a thing with JavaFX application. Application – see the new JavaFX window?

thank you. Andrew

Solution

Although it is still in its infancy, I can already use JavaFX in upshot's repl The main trick is to completely ignore the application and create the scenario directly To do this, you just need to force the runtime to initialize and run it in the core Clj: 69 you can see an example Another trick is that almost everything you do must be wrapped in a run now block to ensure that it runs on a JavaFX thread JavaFX is more picky about threads than swing

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>