r/java • • Dec 29 '22

Could Java Applets have been done right? DOM is limiting [CrossPost Discussion]

/r/webdev/comments/zxel5o/could_java_applets_or_flash_have_been_done_right/
5 Upvotes

50 comments sorted by

View all comments

Show parent comment

2

u/Zardotab Dec 30 '22

Probably no as well for the same reasons.

Could you please clarify why you believe they are not fixable based on new collective knowledge and experience?

1

u/vprise Dec 30 '22

Because there's no alternative to DOM. You would end up with something that looks like a Flash application. If you try to encapsulate DOM (which some solutions tried), you end up as a second tier solution that tries to compete with JS/TS.

We will be starting at a disadvantage that would only widen as there's an official solution and our only option would be to piggyback that.

2

u/Zardotab Dec 30 '22

The Qt or Tk GUI kits can be used as the base to avoid having to start from scratch. It's what Lazarus did.

1

u/vprise Dec 30 '22

So this is a completely different thing. You're talking desktop applications. NOT applets which are integrated in the browser. This is a completely different discussion. Here we could have built a much better solution but the fact that desktop is in decline didn't help. I work for Codename One so my opinions on this are pretty well documented.

2

u/Zardotab Dec 30 '22 edited May 05 '23

I think you are misunderstanding me. A browser is a desktop application (or a native one if on a phone). Think about it. When you build a browser (or browser add-on), you need a UI library of some kind. Chrome has to have a GUI engine that runs on the desktops Chrome is installed on.

As far as integrating such into an existing HTML browser, it depends heavily in the specific architecture used by the browser vendor.

If by chance integration is difficult, the GUI browser (applet engine?) may have to be a separate application. As a compromise, a browser could launch the GUI/applet browser similar to how say Chrome launches a PDF viewer if you click on a link with a ".pdf" extension. Perhaps the extension can be ".gui" so that if you click on "foo.gui", the GUI browser/applet opens and displays (renders) the foo.gui file. And you could also type "www.guis-are-wonderful.com/foo.gui" into the address bar of the GUI browser and get it rendered.

1

u/vprise Dec 30 '22

No. That's not how that works in the native OSs. You need to integrate with the rendering process of the browser directly as modern rendering is GPU based. Otherwise you will create a flickering effect and a situation where rendering looks "off" when you switch. You will also open yourself to serious bugs and failures.

1

u/Zardotab Dec 30 '22 edited Sep 15 '23

We put PDF's and other content into iFrames and FRAMESETS all the time and no puppies died. Maybe you are using a buggy OS. Java Applets were not written directly into the browsers' rendering engines in its heyday, and still displayed. (There were other problems, but none that were proven to be fundamentally unfixable. Flash also could sub-window, IIRC.)

"Every app in a sub-window must use the same rendering engine as the outer window" is an arbitrary, limiting, and unrealistic rule of an OS.

1

u/vprise Dec 30 '22

That's a simple embed. It's got lots of problems and the interactivity is relatively low. There's a reason we don't have an Applet plugin or a Flash plugin anymore.

1

u/Zardotab Dec 30 '22 edited Dec 30 '22

Interactivity was low for corporate political reasons, not technology. There's no reason they couldn't share session and/or cookie variables. Browser venders just need to agree on embedding standards.

There's a reason we don't have an Applet plugin or a Flash plugin anymore.

Because they were too big a security risk. Design/art/game-oriented developers loved Flash because it gave them a level of control that Applets and HTML couldn't.

Maybe someday fairly soon it will be possible to render real GUI's in SVG or Canvas, but it's still silly to download an entire GUI library for each app. For one, it's anti-green, wasting energy. I'll tell Greta Thunberg on you.

1

u/vprise Dec 30 '22

Not just politics and not just those reasons. The plugin needs to run in a restricted container so it won't crash the whole browser. Integrating it with the GPU rendering is a problem. E.g. imagine scrolling the page around and then while scrolling you have to manage something completely alien that needs clipping and all that.

→ More replies