News for hackers. Stuff that matters.
Re:New Java to WASM GC Transpiler: Run Java in the Browser, ... by pestatije on Saturday December 14, 2024 @06:55PM (#42420374)
whats the status of swing? can we port old applets easily? multi-threading or am i dreaming?
Re:New Java to WASM GC Transpiler: Run Java in the Browser, ... by TeaVMFan on Saturday December 14, 2024 @07:18PM (#42420469)
No Swing support at present. There is an issue filed, but it is in need of an implementer: https://github.com/konsoletyper/teavm/issues/406

I made a general guide for migrating from Swing to TeaVM here: https://frequal.com/TeaVM/migration/MigratingFromSwingToTeaV...

For a more specific example, I ported an open-source Java applet and described the process here: https://frequal.com/java/RestoringA19YearOldGameWithTeaVm.ht...

Re:New Java to WASM GC Transpiler: Run Java in the Browser, ... by invalidname on Sunday December 15, 2024 @04:32AM (#42422522)
You can use Codename One whose web port is based on TeaVM. The API is very much like Swing. Albeit more focused on mobile.
Re:New Java to WASM GC Transpiler: Run Java in the Browser, ... by TeaVMFan on Sunday December 15, 2024 @11:37AM (#42424359)
+1 for for Codename One. It is the only tool I use when I need a mobile-only app. I have built numerous apps using Codename One, and have released 2 of them in app stores. Great Swing-like API, great examples, great documentation.
Re:New Java to WASM GC Transpiler: Run Java in the Browser, ... by shannah78 on Sunday December 15, 2024 @09:32AM (#42423581)
I think Swing is a non-goal of this project. It provides good interop with the DOM and core JS methods, and it makes it easy to create your own interop for JS apis that aren't in the core.

There are at least two GUI toolkits that run on TeaVM: 1. Codename One. Similar to swing, but focused on mobile https://www.codenameone.com 2. SnapKit. Targeted at desktop. Also a light-weight toolkit, like Swing. https://github.com/reportmill/SnapKit

Re:New Java to WASM GC Transpiler: Run Java in the Browser, ... by peutetre on Sunday December 15, 2024 @07:34PM (#42427009)
> I think Swing is a non-goal of this project.

It could work though by drawing to canvas.

That's what Avalonia does in C#: https://avaloniaui.net/

Here's a clone of Visual Basic 6 written with Avalonia and compiled to WebAssembly:

https://bandysc.github.io/AvaloniaVisualBasic6/

https://github.com/BAndysc/AvaloniaVisualBasic6

Re:New Java to WASM GC Transpiler: Run Java in the Browser, ... by red1111 on Tuesday December 24, 2024 @05:25PM (#42505382)
If that's your goal, you should look at CheerpJ, which supports Swing and has the goal of making it so you can easily port applets and other existing apps to the web.

I think TeaVM is more focused on letting you share code with the web instead of porting entire apps.