By Subham Aggarwal | 5/18/2017 | General |Beginners

JavaFX vs HTML5

JavaFX vs HTML5

Making a choice for a rich client technology is challenging! Especially when the technologies are in a race to be a leader in their domain. Such is the case with JavaFX and HTML5. In this article I would like to share some of my insights on this topic.

JavaFX

This article doesn't intend to be a battle between JavaFX and HTML5 by making one a clear winner in the end. It actually depends on your use case and requirements. This write up is intended to provide you with some clear criteria to keep in mind when you need to make a choice for your project.

Target Audience

A question worth answering for a Java Developer is if they should adopt JavaFX for their next user interface app or make the switch to an HTML5 technology. I know and love both technologies and I've been using JavaFX since early 2012. Lately I've mostly been programming web applications and will continue to do so in the coming months.

 

I'm not talking about small projects that can be implemented as simple websites with a little interactivity. This article is about rich client applications with a lot of interactive elements.

Difference Factors

Whenever we lay down differences between two technologies, we must agree upon a set of criteria which we will use to compare said technologies. Let us list some of them here:

 

  • Richness
  • Support for different screen sizes
  • Long-term support
  • Learning Curve for the technology
  • Rolling Replacement
  • Deployment
  • Recommendations

Richness

  • JavaFX comes with a decent default theme called Modena which is easily customisable with CSS. With HTML5, clearly everything is possible.
  • With JavaFX, we get the excellent ControlsFX project and also JFXtras which provides complex widgets, something that is a little difficult to find in HTML5.
  • JavaFX also comes with a nice visual designer called JavaFX Scene Builder and we have various tools for HTML5 which are categorised as drag and drop tools.
  • HTML5 can target almost all browsers and all possible screen sizes. This is good but it is also very complex to implement one clean solution that works everywhere.
  • Since JavaFX mainly targets the desktop and HTML5 all possible screen sizes, it is not really fair to compare the two in terms of richness and aesthetics of UI.

Support for Mobiles and Tablets

JavaFX is mainly for Desktop use. JavaFX for Android/iOS is a community effort. There is currently no official support by Oracle.

 

Targeting mobile and desktop browsers is not so complex for HTML5. But to create a larger application that works across many different screen sizes is everything but trivial both from a design and from a technical perspective.

 

Obviously, HTML5 is the winner here.

Learning Curve

When you're a Java programmer and you've created some Swing GUIs, learning JavaFX will be simple but worth your time. As a Java Swing developer, the new possibilities JavaFX offers will excite you.

 

With JavaFX, we get all of the Java 8 features and more, such as:

 

  • Separating the presentation layer with FXML and SceneBuilder. It is also possible to make JavaFX apps completely in Java, without FXML.
  • Using the new Properties classes and ObservableLists for automatic UI updates.
  • Working with the TableView.
  • Using custom CSS for styling.
  • Create custom charts.

 

For a Java developer it is quite difficult to make the switch to HTML5. I know because I've gone that route and it has taken me more than two years to really feel comfortable with the web platform and the various web technologies.

 

It takes quite some time but it is possible for Java developers to make the switch to HTML5 if they are excited about learning new web technologies.

But it will be really difficult for inexperienced web developers to create a well architected and maintainable project.

 

For Java developers it is quite a large step until they will be able to design reasonable web applications. Migrating a larger Swing application to HTML5 without being an experienced web developers would entail a significant risk of failure.

 

JavaFX is the obvious winner concerning the learning curve if your primary background is in a non-web language like Java or C#. If you're already comfortable with web technologies or you're excited to learn something new I recommend you give Dart a try.

Long-term Support

Let us list the long term support received by each community separately.

 

JavaFX

  • JavaFX is now part of JRE/JDK for Java 8.
  • Oracle say that JavaFX replaces Swing as the new client UI library.
  • Java is huge and when used on the client, JavaFX is now the default.
  • JavaFX is open source.

 

HTML5

html 5 

HTML5 is here to stay. But for a business application of significant size you will need to rely on third-party frameworks, tools and maybe even languages.

 

The lifecycle of web frameworks and tools can be quite short. When relying on many third-party libraries and tools you will need to track all the changes and you can only hope that support and updates will continue.

 

I believe Java will still be with us for quite some time to come. With JavaFX you get almost everything you need for your UI from one single source and you know you can rely on it to stay stable for quite a while. Since JavaFX is open source this at least gives you some confidence that an open source community could provide support even if Oracle wouldn't.

Deployment

The promise of Java is "write once, run anywhere". But we've all had problems with deployment of Java programs because the user didn't have the expected Java runtime version.

 

Deploying web applications only requires a web server that users can access with their browsers. This also makes it very easy to distribute updates.

 

HTML5 is the winner in terms of deployment even though JavaFX provides a better solution than before with its native packaging.

Recommendations

All criteria are relevant but I think there are two that might be relevant for most applications: Learning Curve and Options for Mobile and Tablet.

 

The Learning Curve depends on your team: How high is the team's motivation to learn web technologies? Do you have any web developers with experience in architecting complex web applications?

 

If the project is large and your team has limited experience in web technologies I'd consider HTML5 as quite risky. JavaFX might be the safer choice.

 

Let us know what you think in the comments below.

By Subham Aggarwal | 5/18/2017 | General

{{CommentsModel.TotalCount}} Comments

Your Comment

{{CommentsModel.Message}}

Recent Stories

Top DiscoverSDK Experts

User photo
3355
Ashton Torrence
Web and Windows developer
GUI | Web and 11 more
View Profile
User photo
3220
Mendy Bennett
Experienced with Ad network & Ad servers.
Mobile | Ad Networks and 1 more
View Profile
User photo
3060
Karen Fitzgerald
7 years in Cross-Platform development.
Mobile | Cross Platform Frameworks
View Profile
Show All
X

Compare Products

Select up to three two products to compare by clicking on the compare icon () of each product.

{{compareToolModel.Error}}

Now comparing:

{{product.ProductName | createSubstring:25}} X
Compare Now