Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He is responsible for managing the BuildVu product strategy and roadmap, and also spends a lot of his time writing code to build new features, improve functionality, fix bugs, and improve the testing for BuildVu.

Reflecting on Reflections: The JavaFX Reflection Effect

51 sec read

I have been playing with JavaFX recently, and it has to be said that I’ve been having a really pleasant time. The API is really well documented, and the code itself is simple, intuitive and easy get the hang of.

One of the tasks that I had planned for today was to add reflections to the PDF Page Flow mode in our Java PDF Viewer that I have been converting from Java3D to JavaFX.

I was pleasantly surprised when I came to read the Reflection Documentation to find that adding reflections to Nodes is in fact a single line. It really is as simple as this:

ImageView imView = new ImageView();
imView.setEffect(new Reflection());

And now your ImageView has a reflection applied to it!

Unfortunately however, this addition revealed something not so desirable in the output. Here’s a screenshot:

As you can see, there are two ImageViews that overlap, with the one on the right obscuring half of the one on the left. This isn’t reflected on the reflections however, as the middle of the two images merge together incorrectly. The fix should be quite simple, the reflections just need to be cropped to the visible area of the Nodes that they reflect.

I have created a bug report, so hopefully there will be a fix in the future!

I have written several articles on converting our Java3D usage into JavaFX and you can read the other articles here.

Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He is responsible for managing the BuildVu product strategy and roadmap, and also spends a lot of his time writing code to build new features, improve functionality, fix bugs, and improve the testing for BuildVu.

Updates on Java PDF Viewer roadmap from IDRsolutions

My previous blog post (5 changes we are considering in 2016 for IDRsolutions), generated lots of feedback for us (for which we would like...
Mark Stephens
1 min read

My key takeaways from NetBeans Day 2015

NetBeans Day 2015 had to be rescheduled to bigger rooms because of attendee demand. It was a very busy schedule. Here are my notes...
Mark Stephens
2 min read

An Introduction to JavaFX Panes with Code Examples

As a developer at IDR Solutions I spend a lot of my time working with JavaFX and Panes in our JavaFX PDF Viewer. I...
Sylwia Dorota Kedzia
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *