JavaFX Series (PART 1) – Setting up NetBeans for JavaFX Development

JavaFX

Welcome to Part 1 of my JavaFX Series in which we will be getting familiar with JavaFX and how to develop GUI Applications with it.

When I started Java, I usually made Desktop Applications using Swing but it was really a pain in the ass, I was assigned to make a Management system as my semester project (God I hate Management systems now :P), Now at that time I wasn’t familiar with JavaFX so me and my team went with Swing. We were done making the back end functionalities, as soon as we came to the front end, we were just scratching our heads.  Our idea of implementing MVC went to waste, it took too much of our time and still we couldn’t implement it so we went on implementing all the functions behind buttons and stuff (Had no time :-P). After hit and trail method we were done with the majority but the eye candy factor was still lacking, the GUI look of our app was plain dull.

Right after our project submission I found out about JavaFX, when I took some tutorials I was like damn this was the thing I needed for the project. MVC implementation is so much easy. Plus in Swing there was whole lots of mesh code which made it really hard to take care of while in JavaFX it was neat and clean. And the best part is that JavaFX supports skinning using CSS. You can change every aspect of your user interface as you’d like, How cool is that 😀 Hence I was in regret that I should have found out about JavaFX in the first place.

So here are some advantages that JavaFX offers:

  1. Easy MVC Implementation
  2. Better Event Handling
  3. Animations Supported
  4. Eye Candy Factor
  5. CSS Styling
  6. Consistent Controls
  7. Special Effects
  8. Clean Code

So to setup our JavaFX development environment, you’ll have to download the following (Click on the links):

  1. NetBeans IDE
  2. JDK 8
  3. Gluon Scene Builder

We are using JavaFX 8 as we have JDK 8, JavaFX 8 has lots of new improvements.

FXML & Scene Builder

FXML is an XML based language which is used to define the user interface of your JavaFX application. Initially on NetBeans, when you create a JavaFX project, you will be presented with a .fxml file inside which there is nothing but tags that define your GUI. Now you can’t create your GUI blindly by editing the tags, you need some kind of a medium that will visually display the changes that you do to your GUI. This is where Gluon’s Scene Builder comes in .

With the scene builder you no longer need to worry about the FXML file, all the editing you will do to your GUI will be done with the Scene Builder and it’s totally Drag n Drop. Now we just have to setup Scene Builder with NetBeans so that when you click on the FXML file, instead of displaying code, Scene Builder will pop up and you can make the changes there.

Scene Builder with NetBeans Config

You must have installed both NetBeans and Scene Builder, so in order to config them, First start NetBeans.

After starting NetBeans go to Tools > Options > Java > JavaFX

There, just select the path of your Scene Builder directory. Here’s a screenshot

Net Beans Scene Builder Config

Press Apply and OK, You are all done for the config part.

That’s all for the first part of configuring Scene Builder with NetBeans, Now in the next part we will see more details about JavaFX like Stage, Controller Class etc.

Advertisements

One thought on “JavaFX Series (PART 1) – Setting up NetBeans for JavaFX Development

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s