对于Java生态系统中的开发人员,在UI设计方面有一些选择。最着名的是:
现在,有没有针对JRuby / Groovy / Jython或其他“动态”JVM语言的框架或设计替代方案?
一些UI框架是Swing或SWT上的层,例如,框架可以读取XML中的屏幕描述并实例化相应的Swing组件。
如果您了解类似这样的框架,但其目标是JVM“动态”语言,我也希望在答案中看到它们。
答案 0 :(得分:7)
不完全是UI设计,但您可以尝试Griffon。
答案 1 :(得分:2)
Clojure有一些看起来很简单的GUI库/框架:
seesaw在一个非常简洁的DSL中包装Swing,它当然可以用于声明性地创建GUI界面:
(defn -main [& args]
(invoke-later
(-> (frame :title "Hello",
:content "Hello, Seesaw",
:on-close :exit)
pack!
show!)))
Incanter提供了大量的图形和可视化功能(包括JFreeChart等)。不是一般的GUI库,但如果你专注于统计数据非常有用:
;; show a histogram of 1000 samples from a normal distribution
(view (histogram (sample-normal 1000)))
还有一些简洁的示例代码弹出wrapping JavaFX 2.0 in Clojure - 再次这更像是声明性的DSL:
(defn -start [app stage]
(eval
(fx Stage :visible true :width 300 :height 200 :title "hello world"
:scene (fx Scene
(fx BorderPane :left (fx Text "hello")
:right (fx Text "Right")
:top (fx Text "top")
:bottom (fx Text "Bottom")
:center (fx Text "In the middle!"))))))
答案 2 :(得分:0)
我认为Jruby最成熟的两个框架是Monkeybars(http://monkeybars.rubyforge.org/)和Limelight(http://limelight.8thlight.com/)。
Monkeybars是一个完整的rubyesque MVC实现,可以与Swing GUI构建器一起使用,而Limelight可以像Shoes那样实现最小的代码/最大效果比。