r/learnjava • u/Ieris19 • Jun 13 '22
Java User Interface Frameworks
At my university, we have worked with JavaFX which is quite dated as a UI framework for Java, but somehow manages to still be good enough for the simple applications we’ve been building.
I wanna however, move to a more viable framework, but I have no idea what I could use to build a UI in Java other than Swing (which tbh, is no different from JavaFX).
What frameworks are out there that I could use to build a UI? Are there any good resources you know? Any tip is appreciated
3
u/Just_Another_Scott Jun 13 '22
JavaFX isn't dated. It's the most up-to-date Java UI framework. You can use CSS with it to make your UIs look better. It also supports using other web technologies.
-5
u/Ieris19 Jun 13 '22
Yes, however, CSS is not vanilla CSS, it’s FXCSS I think they call it, it’s just a fancy name for changing some aesthetic properties of the components. So that’s a whole other framework to learn that while powerful, it’s not quite as easy.
And sure, web-views in JFX support many other things, but it’s again, nothing other than vanilla websites unless you’re using yet another framework on top.
Finally, JFX on its own has several flaws like not supporting Z-index (or I haven’t figured out how). So while I don’t doubt it’s up to date, and that it can become quite powerful. Without other frameworks it’s quite limited.
It’s also been around for a LONG time so obviously it must be robust. I’m not saying it’s worthless, just dated (just like Java to be fair)
3
u/Just_Another_Scott Jun 13 '22
Yes, however, CSS is not vanilla CSS, it’s FXCSS. I think they call it, it’s just a fancy name for changing some aesthetic properties of the components.
No it's normal css. You just use -fx classes. That's all CSS is. Setting aesthetic properties.
Finally, JFX on its own has several flaws like not supporting Z-index (or I haven’t figured out how). So while I don’t doubt it’s up to date, and that it can become quite powerful. Without other frameworks it’s quite limited.
Anything you can do in another UI framework you can do in JavaFX. It seems to me you are very inexperienced.
It’s also been around for a LONG time so obviously it must be robust. I’m not saying it’s worthless, just dated (just like Java to be fair)
Java nor JavaFX are dated. If you don't like Java then you are more than welcome to not use either. Java and JavaFX are both regularly being updated and improved.
-4
u/Ieris19 Jun 13 '22
Although I am quite inexperienced with UI, and I will have to agree I do not know much, I would then like to know how to use Z index on JFX if you happen to know, as I haven’t found much
And as for the being dated, that’s just a fact. No matter how many updates it gets, no matter the improvements, it’s a child of a different paradigm and as such, it’s quite out of sync with most other more modern alternatives. It doesn’t make it any worse or less powerful, just that it’s focus is quite different from more recent languages and frameworks
4
u/Just_Another_Scott Jun 13 '22
And as for the being dated, that’s just a fact. No matter how many updates it gets, no matter the improvements, it’s a child of a different paradigm and as such, it’s quite out of sync with most other more modern alternatives. It doesn’t make it any worse or less powerful, just that it’s focus is quite different from more recent languages and frameworks
Listen I've been doing UI development for about 15 years now. It isn't any different than QT, Android SDK, AnguoarJS, Angular, .NET, etc. They all follow the same paradigm. So I'm not even sure what you are talking about here.
If you are referring to the use of FXML then QT uses QML. Android uses XML. Angular/AngularJS, ReactJS use HTML which is XML. They all use some declarative language. Most, if not all, desktop application GUI frameworks have the ability to do the same things that web frameworks do.
2
u/pragmos Jun 13 '22
https://openjfx.io/javadoc/15/javafx.graphics/javafx/scene/doc-files/cssref.html#node
Seems like
-fx-view-orderis what you're looking for.
4
u/HecknChonker Jun 13 '22
I'm not aware of any decent alternatives. In most cases java is used as a backend service that supports a UI written in JavaScript. Java based UI frameworks just haven't gotten the same level of support over the years.
The only places I'm really aware of that are using java to build UIs are universities and colleges. I've never seen it used in any corporate environments, and it's usually large corporations that are helping to fund development of the language which might explain why FX has stagnated over the years.
This is just my perspective though, and there might be things I'm just not aware of.
2
u/morbie5 Jun 13 '22
So is java really ever used for PC based applications anymore? I think the only app written in java on my PC is jdownloader 2, and im not even sure if that is still written in java.
3
u/pragmos Jun 13 '22
All of the popular Java IDEs to this date (IntelliJ IDEA, NetBeans, Eclipse) are built in Java.
I also had a big client that offered a desktop application built with Swing as part of their package suite. In the corporate world, Java UI is still a thing, but because it's proprietary software and focused on niche real-world applications, we don't hear about it often.
1
u/HecknChonker Jun 13 '22
Do you know if IDEA built on java FX? Or is it using something more custom?
3
u/pragmos Jun 13 '22
Swing, albeit with a very customized style, that's why it looks so good. You can find the source code of the Community Edition on Jet Brains' GitHub if you're interested.
1
u/3portas Jun 14 '22
There is a lot of financial enterprises using swing in my country. The reason they gave me is to minimize the latency between UI and backend, because they need to get information the most real-time possible, and perform operations real fast too. Besides very specific use cases, I've only worked with swing on legacy code.
•
u/AutoModerator Jun 13 '22
Please ensure that:
Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
You include any and all error messages in full - best also formatted as code block
You ask clear questions
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.