In 2014, we spent a lot of time creating a JavaFX PDF Viewer to complement our existing Swing PDF Viewer (there is a cutdown version used in our NetBeans plugin 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)
- How we are improving our code quality with IDEA in 2018 - March 7, 2018
- How we are improving our code quality with NetBeans in 2018 - March 1, 2018
- 3 ways that the European Union is changing the way Companies write software in 2018 - January 31, 2018
- IDRsolutions product range update for 2018 - January 22, 2018
- 4 ways Companies can make remote working successful - December 21, 2017