Desktop Java

JavaFX Tutorial – Basics

JavaFX seem to be gaining ground on the RIA space. With the right tools and development support, it wil definitely have its toll on the next best technology “thing!”. I’m not writing any JavaFX review here since there is a lot of Technology critiques out there that probably reviewed it extensively, but instead, I will write a simple tutorial on how can you develop JavaFX application in your MacOSX lion.

First some pre-requisites:

  • JavaFX Runtime Environment
  • Java Runtime Environment
  • JavaFX SDK
  • JavaFX Scene Builder
  • JavaFX IDE – I had chosen NetBeans 7 as it already has support for JavaFX.

This can all be downloaded on the Oracle Website. You may google it.

Requirement: Create a simple application that accepts (you guess it) person details (simple registration), a custom web browser and some analytics.

Technology: JavaFX and JPA

Step 1: Create the Database and Tables

Simple Database and Table, download the SQL file: here

Step 2: Create the User Interface and specify the controller

Using the JavaFX Scene Builder, create the user interface.

Step 3: Development

Code the App!

NetBeans has its support for JPA – so I used it to interact with the database.

Download the source: here

Its basically a very simple application, but I think this sample will give you a brief introduction or a head start on how to actually develop an application using the platform.

Not a bad alternative if you want to create Desktop Applications, which of course, .net offers much better solution. Though the main take away here is that JavaFX redefines Java Desktop Application Development – flexible enough to support the best of both worlds (Desktop and Web) and if thats not enough, it also supports mobile phones.

Reference: JavaFX Tutorial – Basics from our JCG partner Alvin Reyes at the Alvin “Jay” Reyes Blog blog.

Want to know how to develop your skillset to become a Java Rockstar?

Join our newsletter to start rocking!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design


and many more ....


Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions


Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newest Most Voted
Inline Feedbacks
View all comments
9 years ago

Thanks a lot

9 years ago

Hi every one you can get started with javafx using this link.,

8 years ago

visit fro javafx tutorials

7 years ago

In the ApplicationController, I think you have to add em.getTransaction().rollback(); in the catch to close the transaction if something went wrong.
ie :
public void initialize(URL arg0, ResourceBundle arg1) {
// Initialization Process.
emf = Persistence.createEntityManagerFactory(“JavaFXApplication1PU2”);
em = emf.createEntityManager();

// Get all data in person table.
try {
//Select all the record from student table
Query query = em.createQuery(“SELECT pt FROM Person pt”);
List lst = query.getResultList();
Iterator it = lst.iterator();
while (it.hasNext()) {
Person person = (Person);
System.out.print(“Name:” + person.getPersonName());
} catch (Exception e) {

Back to top button