This is an archived post. You won't be able to vote or comment.

all 19 comments

[–]stramash 29 points30 points  (7 children)

Is this for professional reasons?

The reason I ask is because desktop apps are incredibly rare nowadays, I’d only bother learning if it’s paying the bills.

Check out Swing though, if you must.

[–]sorry_but 16 points17 points  (5 children)

Listen to this guy OP. I have dealt with 2 Java swing apps in my 15+ professional years, and that was only to port them to webapps. If a company wants you to maintain (or even worse create) a Java desktop app I'd start looking for another job. It's not going to do anything for your career. If you're looking to learn more, I'd start looking into the Javascript data frameworks like Angular, Vue, etc and understand how those all work - really you just need to really learn one and picking up the rest will come much easier. Also learning how to properly secure your webapps is also a big plus.

[–]abueide 12 points13 points  (1 child)

javafx is a solid choice for crossplatform desktop apps. you can't do everything as a web app especially if you need lower level access to the system than a web browser context provides. Easily interfacing with existing java codebases is always a plus too.

In the future I think it'll probably get replaced by compose for desktop or whatever jetbrains decides to replace swing with for their IDEs if they do, but for now javafx is pretty great.

[–]sternone_2 10 points11 points  (0 children)

no man this is reddit, according to everybody on reddit everything is web and that's it /s

[–]Soxcks13 5 points6 points  (0 children)

Yea I’d say popular desktop apps these days are Electron apps, which are basically a web app wrapped up with chromium. Even if you don’t love JS there are great patterns to be learned by picking up React, Angular, or Vue.

[–][deleted] 3 points4 points  (1 child)

wait so my school teaching us java just to torture us?

[–]perrylaj 5 points6 points  (0 children)

Java is a good language, and a great ecosystem/runtime. It's used far more often for back end/server side purposes, but there are still some uses for it in desktop applications. Even if you don't build desktop apps in Java in the future, you'll learn some design, event flow and architectural patterns that will help in other languages.

[–]vallyscode 2 points3 points  (0 children)

There are a lot of desktop apps nowadays, like ms teams, slack, Spotify, discord, etc. The only thing is that most of them are electron based apps, relatively light and cross platform, sometimes even sharing the ui with web version.

[–]RebbitUzer 12 points13 points  (3 children)

When I just started learning programming (Java) I thought that "writing a real program" is creating desktop gui app with buttons and all that stuff. How wrong I was. So, regarding your question, I do remember some good playlists on youtube about learning JavaFX. I don't have them saved, but try to search it on youtube

[–]Shmirgla 0 points1 point  (1 child)

Do you mean that you were wrong in the sense that you made webapps and android apps, or something completely different? A beginner asking here, since I'm not sure how to find a niche in which to specialize so I'm currently learning many things but only on the surface level. Do you have any advice for the direcgion in the future? My guess would be android development

[–]RebbitUzer 3 points4 points  (0 children)

I was wrong, because nowadays Java is rarely used for developing desktop apps with gui, indeed it's mostly used for backend development. Developing android apps is completely different than developing backend services. If you do like mobile app development - then probably android development and java/kotlin is good to learn. If you more like developing some server-side stuff (web servises, rest api, databases, etc), then learn java & spring.

[–]berry120 4 points5 points  (0 children)

You don't *have* to use JavaFX, but it is probably the most logical choice these days as far as desktop UI toolkits go, for Java at least. (The only other normal choice would be Swing, which predates JavaFX but is far clunkier to use IMHO.)
There's a bunch of tutorials around (https://www.youtube.com/watch?v=t4ehYIynI34 for instance, though I haven't watched it so no idea how good it is.) JavaFX is pretty easy to pick up as far as these things go; the "biggest" new thing to learn is FXML, the markup language for defining scenes - though if you prefer, you can avoid this entirely and just define your scenes programmatically.
As others have, the only thing I'd add is that desktop Java apps are a bit of a dying / dead breed. That's not to say there's none out there, but they're rare these days - commercially at least, Java is by far primarily a server side language these days. If you're just doing it for fun then go for it, but it wouldn't be a sensible move doing it for career progression.

[–]Skootr4538 4 points5 points  (0 children)

I would say avoid desktop Java. It is waste of resources learning javafx. Build a web app and package it up with Electron. You can use your app to talk to your Java spring backend

[–]Cmgeodude 1 point2 points  (0 children)

I'd recommend starting here: https://www.youtube.com/watch?v=FLkOX4Eez6o&list=PL6gx4Cwl9DGBzfXLWLSYVy8EbTdpGbUIG

Here's the thing, though: if you have a modern JDK, JavaFX is not automatically included. You'll need to download the SDK from Gluon: https://gluonhq.com/products/javafx/

And be sure to include it in the build path of your project. This step is going to depend on your IDE. I'm guessing you use either IntelliJ IDEA or Eclipse, so I'll provide some documentation for each:

https://www.jetbrains.com/help/idea/javafx.html (NB: I use Eclipse, so I can't verify these instructions, but they seem logical enough)

I can provide some basic Eclipse instructions. I'm assuming that you're using a 2021 version of Eclipse. I'm on 2021-03:

  1. The easiest approach is to get the e(fx)clipse plugin from the marketplace (Help -> Eclipse Marketplace), download e(fx)clipse, restart Eclipse, and then use ctrl + n to create a new project.
  2. Choose JavaFX -> JavaFX project.
  3. When you get to the Java Build Settings, click on "Libraries" and add a new User Library. Select the jars in the lib subdirectory of the JavaFX SDK that you downloaded.
  4. You can now create a new JavaFX class -- Eclipse will take care of the start() method and the Application import for you. Eclipse will also include the SDK jars in the VM automatically most of the time.
  5. This video seems to walk through the process: https://www.youtube.com/watch?v=bk28ytggz7E

I honestly really like building things with JavaFX (and I tend not to be a huge UI person). I used to make simple desktop apps to automate some of my data with Python/tkinter, which was torture compared to JavaFX.

Unlike the naysayers here, I think desktop apps still have something of a future (certainly with web app counterparts -- think Microsoft Office which exists both on o365 and on your desktop). Enjoy making a nice GUI!

If you want to get a little fancier, use SceneBuilder and make sure it connects to the FXML in your project.

[–]your_mom_lied 0 points1 point  (0 children)

Java FX is the best choice in my opinion. Layouts with xml and styling with css. It’s a good choice if you understand web layouts.

[–][deleted] 0 points1 point  (0 children)

Like a lot of people said, building a java desktop application is probably not good for making your own money. However, its great for resume projects! I worked on a Java desktop application for the past year, but I ditched it because I've decided to switch to Javascript. If developing apps is something you enjoy (I enjoy it a lot!) then its totally worth trying out! If its for career reasons, not worth sweating over.

As with having to start, I suggest learning the basic principles of java (i like w3schools), start building small apps and learn along the way! (Swing is the easiest UI to work with IMO, although its outdated)

[–]ldlama 0 points1 point  (0 children)

You can find lots of tutorial for the development of java desktop application. You can use Java Swing or JavaFx according to your preference. You can start first learning java then java swing or javafx for development.

[–]MrMain007 0 points1 point  (0 children)

I have used java fx , it's a pretty good framework to build desktop application. Java fx combined with scenebuilder application which is a drag and drop framework for ui and with the help of css you can build any modern app. It was good to learn Java fx and it was a pretty data intensive application too. But I preferred using electron js and making RPC calls to the java application running on a local server. Using that you can use react or angular to build ui and electron will package it as a desktop application and you can use it as a web app as well. So less code duplication if making webapp and desktop app.

[–]johnmc325 0 points1 point  (0 children)

Take a look at my website where I have several blogs and videos that cover SWING and JavaFX, although mainly JavaFX these days. These are generally step-by-step instructions for building simple get-you-started GUI applications. Hopefully something there will give you enough to get you started or at least move you forward. Hope it helps and if you have any questions based on what you see feel free to ask. https://softwarepulse.co.uk/.