JavaFX Hello World Application

JavaFX Hello World Application

JavaFX is an API from Oracle to develop desktop application including Rich Internet application. You can run this on verity of operating system and devices. Initially JavaFX was develop to replace Swing API as standard GUI library for Java SE. It seems Oracle will continue both in near future. JavaFX is very advance compare to Swing API as it support web browser on Window, Linux and Mac OS. To quickly develop JavaFX application its better to user NetBeans IDE. As NetBeans has not include Scene builder with it so to develop JavaFX GUI you will have separately download and installed and include in your NetBeans IDE. Please click inline link to see tutorial how to install and add Scene Builder to NetBeans IDE. Once that is done then its very easy to write JavaFX Hello World application.

Tools needed:

  • NetBeans IDE
  • JDK 1.8

Steps:

  • Open your NetBeans IDE then follow on screen steps as below:

JavaFX Hello World Application

JavaFX Hello World Application

JavaFX Hello World Application

  • Now you will see project got created on left hand side as below:

JavaFX Hello World Application

  • By default NetBeans will create new Java class Hello World application name:¬†JavaHonkJavaFXHelloWorld.java. Now to run this application click run as below:

JavaFX Hello World Application

  • This will start JavaFX Hello Word application with one default button Click Me as below:

JavaFX Hello World Application

  • Click Me button will fire event which will be receive in controller¬†FXMLDocumentController.java and you will see below output:

JavaFX Hello World Application

  • That’s it. Next tutorial we will cover how to create GUI using JavaFX. For more details information please visit Oracle tutorial here

Leave a Reply

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