Introduction to JavaFX

JavaFX is a software platform for creating and delivering rich internet applications (RIAs). Swing and Adobe Flex are similar technologies. Though JavaFX is primarily suitable for desktop applications, it is also suitable for enterprise applications. We will first see where JavaFX fits and its future by comparing it with similar technologies, and then we will see its version and history in brief, an overview of some JavaFX tools and later we will see some sample JavaFX programs.

 

JavaFX vs Swing

JavaFX is intended to replace Swing as the standard GUI library for Java SE, but Swing will be included in JDK for backward compatibility. Swing is mature enough, but Oracle confirms that JavaFX is the replacement for Swing and also that JavaFX is the future path in the link http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html.  Hence JavaFX is our current UI technology direction for RIAs. You can read all our technology directions @ http://www.javajee.com/our-technology-directions.

 

JavaFX vs Adobe Flex

Adobe Flex is another similar technology platform. I had worked with Adobe flex using Flex builder and had integrated it well with Spring and Hibernate in one of my project. However, comparing JavaFX vs Adobe Flex today, I strongly believe JavaFX is the way now because of the fact that JavaFX is from the owners of Java and is also free. Adobe is also moving most of the Flex into a community-driven open source project (Ref: http://www.adobe.com/devnet/flex/whitepapers/roadmap.html) mainly due to other competing technologies such as JavaFX and HTML5. Hence even though I have worked more on Adobe Flex, JavaFX is our current UI technology direction for RIAs.

 

JavaFX vs JSF

Though this is not actually a valid comparison, I have seen many questions related to JavaFX vs JSF. Java Server Faces (JSF) is Java’s server side technology which is an evolution of Java Server Pages (JSPs) and adds more lifecycle. JSF is a server side technology part of Java EE specification and is implemented by compliant application servers and JavaFX is part of JDK. JSF does most of the work at the server side and interacts with the browser using standard HTML controls and interactions. JavaFX requires JVM to run on the client side and hence are heavier to browsers. JSF is useful for most server side websites provided over internet as it doesn’t require much client side setup. JavaFX is required for rich internet applications (RIAs). JavaFX can be compared to Adobe Flex which requires Flash Player to be installed at the client side.    

 

JavaFX 8 vs JavaFX 2.x vs JavaFX 1.x

As of this writing current version of JavaFX is JavaFX 8 as it is part of JDK 8. Previous version (which is almost same) was 2.2. From Java 8 Oracle decided to have same numbering for JavaFX as that of Java. JavaFX 8 is same as JavaFX 2.2 in architecture and adds more features on top of JavaFX 2.2. Before version 2.0 of JavaFX, in JavaFX 1.x, developers used a statically typed, declarative language called JavaFX Script to build JavaFX applications. Because JavaFX Script was compiled to Java bytecode, programmers could also use Java code instead. JavaFX applications could run on any desktop or any browser that could run Java SE. However, JavaFX 2.0 and later is now implemented as a native Java library and therefore applications using JavaFX are written in native Java code. JavaFX Script has been scrapped by Oracle, but development is being continued in the Visage project. Oracle plans to integrate JavaFX to Java SE embedded 8, and more integrations and features are on the way.

 

JavaFX development tools

JavaFX provides tools that help to develop as well as design functional and visually pleasing applications. As of JDK 7 update 6, JavaFX is included with the standard JDK and JRE bundles. Hence you don’t have to download it separately if you have a JDK version higher than JDK 7 update 6.

An integrated development environment (IDE) is a software application that provides many facilities to computer programmers for software development such as code editor, debugger, GUI builder etc. Netbeans IDE, from Oracle itself, is a very useful IDE when working with Java’s UI technologies like Swing, JavaFX or JSF and provides many GUI building features out of the box. However we will focus less on Netbeans and focus more on Eclipse IDE. Eclipse is also very popular, is plugin based with enough plugins for most use case. Also, in my software industry experience I have been using eclipse for almost all projects till date. You can find our eclipse notes @ eclipse-ide-notes.  The best thing about JavaFX is that Oracle also provides another very useful tool called ‘JavaFX Scene Builder’ which is independent and not tied to an IDE, but can be used with any IDE including eclipse. You can go to the download page for screen builder from the Java SE download page, download and install it easily through few clicks. You can then configure eclipse to use JavaFX and JavaFX scene builder by installing the eclipse plugin by following tutorial @ http://docs.oracle.com/javafx/scenebuilder/1/use_java_ides/sb-with-eclipse.htm.  

 

Reference

http://en.wikipedia.org/wiki/JavaFX

http://www.eclipse.org/efxclipse/install.html

http://docs.oracle.com/javafx/scenebuilder/1/get_started/jsbpub-get_started.htm

Quick Notes Finder Tags

Activities (1) advanced java (1) agile (3) App Servers (6) archived notes (2) Arrays (1) Best Practices (12) Best Practices (Design) (3) Best Practices (Java) (7) Best Practices (Java EE) (1) BigData (3) Chars & Encodings (6) coding problems (2) Collections (15) contests (3) Core Java (All) (55) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exception (1) Exceptions (4) Exercise (1) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (5) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (9) java ee exercises (1) java ee interview questions (2) Java Elements (16) Java Environment (1) Java Features (4) java interview points (4) java interview questions (4) javajee initiatives (1) javajee thoughts (3) Java Performance (6) Java Programmer 1 (11) Java Programmer 2 (7) Javascript Frameworks (1) Java SE Professional (1) JPA 1 - Module (6) JPA 1 - Modules (1) JSP (1) Legacy Java (1) linked list (3) maven (1) Multithreading (16) NFR (1) No SQL (1) Object Oriented (9) OCPJP (4) OCPWCD (1) OOAD (3) Operators (4) Overloading (2) Overriding (2) Overviews (1) policies (1) programming (1) Quartz Scheduler (1) Quizzes (17) RabbitMQ (1) references (2) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Site Usage Guidelines (1) Sorting (1) source code management (1) spring (4) spring boot (3) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) troubleshooting (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)