JavaFX Project Structure

前端 未结 1 474
庸人自扰
庸人自扰 2021-01-31 04:22

JavaFX\'s MVC Model by using FXML sounds awesome and all but I\'m having trouble find out how to organize my project packages.

Every single tutorial i find about JavaFX

1条回答
  •  有刺的猬
    2021-01-31 04:56

    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!

    0 讨论(0)
提交回复
热议问题