In 2014, we spent a lot of time creating a JavaFX PDF Viewer to complement our existing Swing PDF Viewer (there is a cutdown open source version and the full commercial version is part of the JPedal library).
This was a very interesting comparison for us so I thought that the start of 2015 would be a good opportunity to share with you the main advantages we found in JavaFX as compared to Swing.
So, while we will continue to maintain and support our Swing PDF Viewer, below are 5 reasons why we think JavaFX gives us more options to further develop our PDF viewer in its JavaFX version and why you should also consider JavaFX in your projects.
1. Closer match to how PDF actually works.
JavaFX using a tree/node structure with values inherited from nodes while Swing has an essentially iterative, flat structure. PDF is built around a tree structure so it is much easier to map onto JavaFX than Swing. We have only made limited use of this so far and will be making more use of this in 2015 to improve the way we handle XForms and things like Opacity.
2. More features.
JavaFX has much more functionality than Swing. This in not just with new effects and transitions but also in general features. As one example, it is much easier to create Shapes with variable line withs compared to Swing/Graphics2D.
3. More compact and simpler code.
Our development team were very impressed at how much shorter the code we wrote to reimplement features in JavaFX was compared to the equivalent in Swing. JavaFX also takes much of the low level tedium out of the code (you do not need to implement your own paint() and print() methods in JavaFX as you do in custom Swing Components.
4. Target devices.
JavaFX is an integral part of Java8 and there are is a lot of activity on getting it to work with Android and on embedded devices such as Raspberry Pi. It can also interact with Swing in existing applications. If you want to see you software across the widest range of devices, JavaFX is the way to go.
5. Future developments.
Swing is not going away, but on the other hand it is not going anywhere new… JavaFX will be where any new developments happen with Java.
We have lots of JavaFX developments planned in 2015 (and will be writing lots of JavaFX related content on our blog). So I hope you will try our JavaFX PDF viewer, and stay tuned on developments. Happy New 2015!
Latest posts by Mark Stephens (see all)
- NetBeans Day UK announced for Tuesday 25th April 2017 - February 1, 2017
- The 2017 Guide to PDF Files – Creation II - January 19, 2017
- The 2017 Guide to to PDF Files – Creation I - January 17, 2017
- 7 ways we might change the way we develop software in 2017 - January 6, 2017
- IDRsolutions will move to Java8 in April 2017 - November 8, 2016