DEV Community

Martin Klestil
Martin Klestil

Posted on

JavaFX Notepad Tutorial

Hello World!

I would like to share my learning journey with JavaFX, this is my notepad project.

Image description

Before starting

Java Version: openjdk 22
IDE: IntelliJ Community Edition
Build Tool: Maven

My Plan

If you look at Notepad you can break it down into a few parts. Menu, TextArea, Icon, Title, Control (Close...).

Image description

Time to code

I create with IntelliJ a new JavaFX Project and start with a mvc architecture.

Image description

MainView

The MainView gives me my root element for the Scene, this is where the text area and the menu are added.

Image description

Menu

Next we create the menu. I have created helper functions for the individual menu areas.

Image description

Model

Than we must implement some logic, to make the Menu clickable, editable the text ...

Image description

You can play around here and add all the features you want.

Controller

My controller only connects the view to the models.

Conclusion

Thank you for reading this far! I'm still new to writing articles and have a lot to learn. I appreciate for your feedback.
Happy coding 😊

Top comments (0)