I despise cross-platform GUIs as a concept, but if you must make one, there's plenty of options usable from most languages. Java has Swing, C++ has Qt, there's things like Flutter and WxWidgets and a dozen different GUI libraries for Rust. Heck, you can even build GUIs in Python with tkinter. Every single one of these options is much better suited for an app than the web stack.
My main gripe with using the web stack for building apps is that, unlike proper GUI framework, your platform is not made out of the same kind of code that you're writing. For example, there's a number of predefined layout algorithms that you can choose from and then control some of their parameters, but you can't write your own layout algorithm. You can kinda draw your custom controls, but both <canvas> and SVG are not without their own shortcomings compared to real GUI frameworks. A web browser is a glorified scriptable word processor so it's not surprising that it acts like one.
Yes, there are "paint worklets" and "layout worklets" as proposals. That kinda makes it better but still feels like an ugly workaround. The declarativeness of HTML and CSS, extremely awkward for building app-like UIs with, is also never going anywhere.
Of course you can - in javascript. What is stopping you? (except that you don't like it)
You can also ditch the DOM alltogether and only use the canvas/webgl and maybe your language of choice via emscripten and wasm, if you really cannot stand js/ts.
The web as a plattform is very, very powerful.
The app you make, you can ship by simply sending a link. And people can just try it out without installing something and all quite save in a sandbox.
So none of your solutions are better suited than the web stack, if you intend to target the maximum audience with the minimum hazzle. You have to beat that, if you want to overcome the web.
Also, can you give me one example of a nice looking app in swing? Websites are optimized for enabling good UI and UX. Because the moment a user is confused - he is gone very quickly.
And people can also customize their experience. I use dark reader and ublock.
HTML and everything around it is often a ugly chaotic mess, but a incredibly powerful one.
> Of course you can - in javascript. What is stopping you? (except that you don't like it)
If you mean by setting `position: absolute` and then using left/top/right/bottom to position your element, that won't work. You can't plug your code into the browser's layout dispatching mechanism to correctly react to size changes, reflows and all that. You can do that in any native UI framework.
> The app you make, you can ship by simply sending a link.
Depends on what it does. If it needs to store data locally and/or work with files for example, doing that on a website that runs in a browser is a pain in the ass both for the developer and the user. Last time I checked, if you want to generate a file for the user to save, you have to encode it into base64 and "open" it as a data: URI. Isn't that utterly bonkers?
> Also, can you give me one example of a nice looking app in swing?
IntelliJ IDEs.
> Websites are optimized for enabling good UI and UX.
Is that the reason there's so much whitespace everywhere these days? Is that also why all controls are so confusing that you sometimes have to try interacting with them to understand what they do?
> Because the moment a user is confused - he is gone very quickly.
Not everyone's goal is to simply have as many users as possible.
"If you mean by setting `position: absolute` and then using left/top/right/bottom to position your element, that won't work."
Erm, but it does? You can listen to resize events and you can get the exact width and height values of all the elements in the DOM. I am using that technic since I switched to the web (when box layout did not exist yet).
The only problem with this is, that you can create performance bottlenecks easily, as reading clientWidth might trigger a forced reflow. So it might not be easy at first to get everything right, but it is totally possible.
Also you can just use a different GUI framework or build your own.
"Not everyone's goal is to simply have as many users as possible."
Mine neither, but those who do (the majority) made sure, the web is suitable to be used by even the most tech illiterate people.
My mother can surf the web to get mostly what she wants - but she cannot use a file browser, nor does she really know what a file is (and she does not want to know).
"> The app you make, you can ship by simply sending a link.
Depends on what it does."
Sure, if you want native file system access, you would be breaking the sandbox. And yes, this is my biggest pain point with the web as well - that it often cannot decide whether it serves untrusted websites or enables app developement where the user trust the app. For example there is no (easy) way to get the pixel data from html elements, because of security. Which makes sense for malicious add filled websites, but not when developing something real, where the user could give permission. Here the focus on the dumbest users who just all allow everything, so the browsers have to protect them and allow no one to use proper permissions is really annoying. Because yes, I also would just like to have file access and other things permissions don't allow.
Forget all of that. If you can run actual video games in a browser at 120fps, you can definitely achieve pretty much any UI/ux you can dream. Obviously, within resource constraints. But I don't think there's many UIs you can build that are reasonable and slow on the web but fast in Java swing (or whatever other UI framework you're using)
My main gripe with using the web stack for building apps is that, unlike proper GUI framework, your platform is not made out of the same kind of code that you're writing. For example, there's a number of predefined layout algorithms that you can choose from and then control some of their parameters, but you can't write your own layout algorithm. You can kinda draw your custom controls, but both <canvas> and SVG are not without their own shortcomings compared to real GUI frameworks. A web browser is a glorified scriptable word processor so it's not surprising that it acts like one.
Yes, there are "paint worklets" and "layout worklets" as proposals. That kinda makes it better but still feels like an ugly workaround. The declarativeness of HTML and CSS, extremely awkward for building app-like UIs with, is also never going anywhere.