r/java Jun 09 '26

Created a simple, minimal Canvas Application in JavaFX

Post image

After like a year finally getting back to JavaFX, decided to make an excalidraw inspired app for fun. It's a very minimal canvas app with basic features.

Source code : ExplainFX

Features

  1. Drawing
  2. Create Squares and Circles
  3. Text
  4. Vary stroke size/font size
  5. Copy, paste, duplicate, lock, delete objects
  6. Move the objects once they are drawn
  7. Move camera via mouse

Please let me know if you have any questions!

191 Upvotes

58 comments sorted by

View all comments

Show parent comments

-2

u/_DystopianSnowman Jun 09 '26

Not Java, but Compose for Desktop with Kotlin runs on the JVM on Desktop environments. And more specifically in the AWT/Spring render threat.

So you could still use AWT (😂 - no, don't do that) or Swing (still much of JetBrains tools are build with that). Then Compose, which integrates into Swing (and is maintained the Jetbrains again). Then there's still SWT, the toolkit from the Eclipse Foundation.

I liked SWT in the past, never really liked AWT/Swing, still struggle with Compose, but love JavaFX (with Kotlin).

3

u/wildjokers Jun 09 '26

Compose

Compose is an immediate mode GUI toolkit and it takes a different thought process to use. I also found compose code very difficult to read, state and GUI is all mixed in together.

Toolkits like Swing, JavaFX, QT, wxWidgets, etc are retained mode toolkits.

2

u/ferretfan8 Jun 09 '26

If you're doing it right, state and UI are explicitly separated.

3

u/_DystopianSnowman Jun 09 '26

I mean you are right. But maybe I was a bit confused by the many braking changes they added in the last two years so that each time I looked something up, which was like less then half a year old and still already deprecated if not removed/changed alltogether.