• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Suggestion needed for Standalone Java application

 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I have been working with Java in Web environments for the past 10 years.

For the first time, a client asked me to develop a financial application that shall be installed on a given PC.

This application must be a standalone application. Knowing Java I thought of Swing...but I also know I have been out of that game for soooooo long :-)

Hence my questions (forgive me if they sound silly):
1) are people still using Swing for standalone Java based applications?
2) is there anything else other than Swing?
3) can you please recommend a book or other resources to freshen up my knowledge of how to design a decent Java based standalone application?

Thanks a lot in advance!

Any pointer or comment is very much appreciated!

I look forward to hearing from you.

Cheers,
Giovanni
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the Java version targeted?

Oracle now promotes JavaFX for developing desktop applications - it is a good toolkit with CSS styling for UI. And has been integrated into Java SE fully since version 8. However, there will be a learning curve.

Another option is to look at platforms like NetBeans RCP if it is a large/rich application to be built.
 
Giovanni De Stefano
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply.

Ultimately I will have to package the application with an installer, which might come with its own java runtime, so I can make the dependency with version 8.

I will start digging into JavaFx then :-)

Cheers!
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For standalone apps, there are a few options: Swing/AWT, JFace/SWT and JavaFX.

Whichever one you decide to use will need learning curve or at least time to get back the groove.

JavaFX is indeed a good choice.

Another concern is it considered to be a "enterprise client" app meaning able to be connect to EJB and stuff? If so Swing may be a better choice for better integration.
 
Giovanni De Stefano
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The standalone app will need to connect to a couple of DBs, show tables, and most likely some graphs.

Is JavaFX still a good choice for this scenario?
 
K. Tsang
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DB connection shouldn't be a problem. The graphing part ... well don't know about JavaFX or Swing for that matter.
 
Rancher
Posts: 387
30
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Ultimately I will have to package the application with an installer, which might come with its own java runtime

Use the new self-contained packaging features of JavaSE:
https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html
You can trigger these features using Maven/Gradle/Ant scripts, just google JavaFX Maven Plugin/JavaFX Gradle Plugin.
The packaging features are not JavaFX specific, so it can work for Swing/SWT apps as well, though, in general, for new apps I'd recommend JavaFX development over using the other toolkits (unless you need to base the app on the NetBeans or Eclipse platforms).

> Another concern is it considered to be a "enterprise client" app meaning able to be connect to EJB and stuff? If so Swing may be a better choice for better integration.

I don't think it makes any difference really. I doubt it is going to be easier to connect to back end services using Swing vs JavaFX vs SWT. It will probably be a pretty equal amount of work for each.
I wouldn't recommend connecting directly to EJBs or using the old JEE remote EJB client libraries (e.g. not this: http://www.mastertheboss.com/jboss-server/jboss-as-7/jboss-as-7-remote-ejb-client-tutorial).
Instead use Rest/Akka/WebSockets - something like that.

> The standalone app will need to connect to a couple of DBs, show tables, Is JavaFX still a good choice for this scenario?

Yes JavaFX is still a good pick for this IMO. JavaFX does not have built-in DB connectivity (neither do other Java UI toolkits like Swing/SWT).
There are some things out there which may assist you in your connectivity (for instance http://www.javafxdata.org). But get prepared to do some work yourself.
Here is a really basic JavaFX/JDBC connectivity sample (https://gist.github.com/jewelsea/4955598), though if you are doing a lot of database work, you are probably better doing it with JPA and a traditional Spring/JEE server and communicating with that over the network from your JavaFX client.
JavaFX has a TableView component https://docs.oracle.com/javase/8/javafx/user-interface-tutorial/table-view.htm which has a lot of functionality. Just don't expect it to have all the functionality of an Excel spreadsheet or a Microsoft Access Database backed table widget.

If you require that more advanced database backed spreadsheet style of stuff, you might want to look for an existing Swing component you could embed using a JavaFX Swing Node, or something like TiwulFX might be able to help: http://tiwulfx.panemu.com. But in all, none of these Java UI toolkits are quite like the old Delphi/MS Access/PowerBuilder systems which helped you to build certain kinds of applications in a RAD environment. For instance, you won't be able to create this in six lines of code: http://www.infoworld.com/article/2631597/development-tools/new-sybase-powerbuilder-12-requires-little-coding.html. Be prepared to write some code, possibly a lot of it and it is going to take time and skill.

> and most likely some graphs. Is JavaFX still a good choice for this scenario?

Yes JavaFX is still a good pick for this IMO. JavaFX has a built-in graphing library.
http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/charts.htm
The built-in JavaFX charts look great and are very easy to use for basic charting purposes.
The charts include the ability to listen to changes on observable data sources and animate visual chart changes based upon that.
The charts are also fully stylable via CSS (just like everything else in JavaFX):

If you require full scientific charts, you could use a JavaFX => Java2D bridge (which is actually simple and painless) + JFreeChart/OrsonCharts
http://java.dzone.com/announcements/fxgraphics2d-bridge-java2d
Though I'd tend to stick with the built-in JavaFX charts rather than using a bridge if the functionality in the standard JavaFX charts is enough.

Also note that JavaFX comes with WebView which can render charts from HTML, so you can use HTML based charting libraries as well if you need to:
https://docs.oracle.com/javase/8/javafx/embedded-browser-tutorial/
There are some great HTML based libraries out there, like fusion charts and high charts:
http://www.fusioncharts.com
http://www.highcharts.com

WebView can of course be used for displaying any kind of web content, so you can a develop a hybrid HTML/Java client app if you wanted. Though I think if you tried to do a lot of communication over the Java/JavaScript bridge, things would get pretty intertwined and painful quite quickly.
 
Giovanni De Stefano
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again John,

you are a rock star ! :-)

I started development of the backend (Spring Boot, JPA, REST) and at the same time I am almost half way through "Apress JavaFX 8 Introduction by Example 2nd edition".

Your help is very much appreciated!

Thanks again!

Cheerios,
Giovanni
 
"To do good, you actually have to do something." -- Yvon Chouinard
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic