Recently, I have been working on producing a JavaFX implementation of the Swing PDF Viewer in our JPedal PDF library. This has involved a large amount of refactoring to separate out common, shared code and then implementing JavaFX specific functions or optimisations.
One of the features which we make extensive use of in our PDF viewer is listeners. When you scroll inside a PDF file, Java is not fast enough to decode every page in real time as you scroll through the PDF document if you just want to scroll very quickly. If we did this, some documents would be fine but some would be very sluggish and slow. As they scroll, we display the page borders with a white background.We wait for the user to stop scrolling and as soon as they pause, we will decode the visible pages.