zoukankan      html  css  js  c++  java
  • Getting Started with JavaFX

    https://openjfx.io/openjfx-docs/#maven

    Run HelloWorld using Maven

    If you want to develop JavaFX applications using Maven, you don't have to download the JavaFX SDK. Just specify the modules and the versions you want in the pom.xml, and the build system will download the required modules, including the native libraries for your platform.

    Here is a pom.xml file which shows how to achieve this, included in this sample.

    Alternatively, we have created JavaFX Maven Archetypes to quickly create Maven projects. A simple JavaFX project can be created by executing the following command:

    
    mvn archetype:generate \
            -DarchetypeGroupId=org.openjfx \
            -DarchetypeArtifactId=javafx-archetype-simple \
            -DarchetypeVersion=0.0.3 \
            -DgroupId=org.openjfx \
            -DartifactId=sample \
            -Dversion=1.0.0 \
            -Djavafx-version=17
    

    The pom uses the JavaFX Maven plugin:

    
    <plugins>
        <plugin>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>0.0.8</version>
            <configuration>
                <mainClass>HelloFX</mainClass>
            </configuration>
        </plugin>
    </plugins>
    

    Add the maven dependencies:

    
    <dependencies>
      <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>17</version>
      </dependency>
    </dependencies>
    

    Important: Note that transitive dependencies are automatically resolved (for instance, there is no need to add a dependency for the javafx.graphics module, since it is transitively resolved by the javafx.controls module). But if your application is using FXML, you will need to add a dependency for the javafx.fxml module as well.

    Finally, run the application (e.g. based on the HelloFX.java from the referred sample):

    
    mvn clean javafx:run
    
    Note: Make sure to set the JAVA_HOME environment variable to the correct JDK location.
  • 相关阅读:
    (3)C++复合类型
    (2)C++基本类型
    (7)js调试
    Oracle语句优先级
    oracle排序问题
    jsp四大对象
    postgresql时间加减计算
    全角空格,跟汉字一样宽
    bzoj1433 [ZJOI2009]假期的宿舍 最大流
    BZOJ 1264 AHOI2006 基因匹配Match 动态规划+树状数组
  • 原文地址:https://www.cnblogs.com/exmyth/p/15529100.html
Copyright © 2011-2022 走看看