Kieran France Kieran France is a programmer for IDRSolutions in charge of there internal test suite. In his spare time he enjoys tinkering with gadgets and code.

Experimenting with JavaFX and Java 8

1 min read

Since JavaOne I have decided to spend some time experimenting with JavaFX and Java 8 via the early bird release. The main new feature that I wished to experiment with was the printing api being added to JavaFX in this version. So far I have had very little to do with JavaFX so some of the things I have found and my opinions will not be new to those who have been using it for awhile, although there may be something new to you in my thoughts of some of the new things in Java 8.

So first off I should talk about setting up the new release. First I downloaded and installed the early bird release and began following some basic instructions that would give me a copy of eclipse (my preferred IDE) with beta 1.8 support. What I had seemed to work fine for the new javaFX api but the IDE did not recognize lambda expressions. For this reason I decided to give Netbeans 7.4 a try*.

Having already installed the early bird release, setting up the Netbeans 7.4 was incredibly easy, during installation I just had to point the IDE to the 1.8 JDK and it was set up and working. After trying some examples I found that Netbeans had support for lambda expressions and the expanded JavaFX api.

First thing I did was set up a simple printing example using the example code found in the JavaFX Printer docs page.

Node node = new Circle(100, 200, 200);
PrinterJob job = PrinterJob.createPrinterJob();
if (job != null) {
   boolean success = job.printPage(node);
   if (success) {

I must admit I like the idea behind the printing. Once you have created a node you only need to pass it to the printer and it can be printed. This means that once you have, for instance, got your pdf page drawn onto a node, in order to print a page all you need to do is use a PrinterJob to print the page. This is nice a simple.

There are down sides as well. The node being printed should not be altering during the printing otherwise the output image can be affected. For this reason it is recommended that any nodes being printed should not b altered. It seems the safest way to print would be make a duplicate of the node to be printed so we have a copy to print with and still allow the onscreen copies to be modified.


*Since trying NetBeans I have found that Eclipse appears to have some support for lambda expressions and now I believe I may have accidentally acquired an older beta version which may explain my issues when trying to get things up and running.


This post is part of our “Java Articles Index“ series. In these articles, we aim to explore the world of Java and Javafx. Have a look through!

Do you need to solve any of these problems in Java?

Convert PDF to HTML5
Convert PDF to HTML5
Convert PDF to SVG
Convert PDF to SVG
Convert PDF Forms to HTML5 Forms
View Forms in the browser
Java PDF Reader and Viewer
View PDF Documents
Convert PDF to image
Convert PDF to image
Extract Text from PDF
Extract Text from PDF
Read/Write images in Java
Read/Write images
Replace ImageIO
Replace ImageIO
Convert Image to PDF
Convert Image to PDF
Kieran France Kieran France is a programmer for IDRSolutions in charge of there internal test suite. In his spare time he enjoys tinkering with gadgets and code.

Leave a Reply

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

IDRsolutions Ltd 2021. All rights reserved.