如何在SWT中嵌入JavaFX

原来的程序是用SWT构建的,客户最近留意到了JavaFX,就让我研究研究能不能把SWT和JavaFX结合起来。

 

经过几天的研究,结论是可以,但是代价很大。刚刚写了封邮件给客户。

 

1.    What is JavaFX?
    It is a rich client platform for building cross-device applications and content. JavaFX is Sun's competition to the two main RIA implementations available - Microsoft's SilverLight and Adobe's Flex/AIR.
2.    Language and development
    JavaFX script is the language for code program of JavaFX. They called it “script”, but it is different from
the other Interpreted Languages like JS. It must be compiled first by JavaFX runtime to jar file, then you can invoke it in local computer or
through Java web start.
Before you develop the javaFX, you have to install JavaFX SDK. And also your computer needs to install JavaFX Desktop Runtime, then it is able to launch JavaFX program.
Now official ide is NetBeans. There is a plugin of Eclipse, but it is really simple and hard to use.
3.    Is it able to embedded to SWT?
     This is a biggest trouble we are going to facing if we want to use it in Qrodo.
There is no official way to get JavaFX embedded into Swing (or SWT) application.
This article (http://blogs.sun.com/javafx/entry/how_to_use_javafx_in) has a detailed introduction about this problem.
We can embedded it into Swing and embedded the Swing composite to SWT by SWT_AWT bridge. This would be very complicated and weird. 
4.    What can we do using JavaFX? What Can JavaFX Do That Swing and SWT Can't?
   The term Rich Internet Application can be defined as an web application that takes on the characteristics of a desktop application.
“The key use case for me, is for those who are starting an application from scratch. If it needs to interact with other Java components and libraries,
 JavaFX is a good choice for your UI layer. If you want to write an application to work on the desktop and on mobile devices, with minimal deployment headaches,
this is the technology you need. The single-sourcing aspect of JavaFX is the main advantage.”( http://java.dzone.com/articles/what-does-javafx-mean-you)

I think if we want to develop a mobile Qrodo on cellphone, maybe JavaFX is a choice. But as my understanding, I don’t suggest we combine it with SWT.
There is no proper plugin of Eclipse for developing JavaFX. We need to include many libs of JavaFX, the size of Qrodo will grow bigger. The user have to install JavaFX runtime before run Qrodo.
There are potential risks of embedded JavaFX to SWT that not supported by JavaFX official.
The effect that JavaFX can does, is also able to implemented by SWT.

现在Javafx官方还不支持javafx嵌入SWT的composite中,有人做了尝试把javafx嵌入到SWING中,所以通过SWT_AWT可以把SWING嵌入到SWT中,等于把javafx嵌入到SWT中了。但是没有官方的这方面的应用,风险是很大的,所以不推荐客户这样做。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值