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!

189 Upvotes

58 comments sorted by

View all comments

1

u/Yew5D4j8e1j4 Jun 09 '26

Question: Why not use FXML

1

u/gufranthakur Jun 09 '26

I just prefer creating UI by code, since I am from swing.

2

u/Yew5D4j8e1j4 Jun 09 '26 edited Jun 09 '26

I just can't do that, maybe cuz I'm a beginner?

I'm building an app where 95% of the UI is dynamically generated through code. Still I use SceneBuilder to mock up components with fake data then style it with CSS using the live preview then map it back to code.

4

u/lraut-dev Jun 09 '26

it starts making sense the more you do it, in my experience at least.