JavaFX Project Structure

IMHO, you shouldn’t create package’s depending on your views.

My approach towards such applications

  • A package for corresponding controllers of these views
  • Different packages for service(business) and dao(persistence) layer, if exists
  • A directory for resources such as images, css etc
  • A directory for FXML files called view in the resources

    src/main
      ├──java
         ├── controllers
            ├──Screen1controller.java
            ├──Screen2controller.java
         ├── service
            ├──Service1.java
         ├── dao(persist)
            ├── SaveProducts.java
      ├──resources
         ├──view
            ├──screen1.fxml
            ├──screen2.fxml
         ├──css
            ├──style.css
         ├──images
            ├──img1.jpg
            ├──img2.jpg
    

The above implementation can be considered for a Maven project.

For a simple project, you can view a structure here. It is a maven project!

Leave a Comment