반응형

 - maven non-modular

 - gradle non-modular

 - maven modular

 - gradle modular <-

 

 

*** First. java 11 or higher download and install here

 

Eclipse info

 

1. Eclipse download here

   - Eclipse IDE install

 

2. javaFX SDK Download here

 

JavaFX - Gluon

Long Term Support JavaFX 11 is the first long term support release of JavaFX by Gluon. For commercial, long term support of JavaFX 11, please review our JavaFX Long Term Support options. The JavaFX 11 runtime is available as a platform-specific SDK, as a n

gluonhq.com

 

3. Eclipse -> Help -> Eclipse Marketplace...

 

4. search javafx -> e(fx)clipse install -> eclipse re-start

 

 

5. New -> Project...

 

6. Gradle Proejct -> Next

 

7. New

 

8. Project name : helloFx -> Finish

 

9. build.gradle open

10. modify 

plugins {
  id 'application'
  id 'eclipse'
  id 'org.openjfx.javafxplugin' version '0.0.8'
  id 'org.beryx.jlink' version '2.12.0'
}

repositories {
    mavenCentral()
}

javafx {
    version = "11.0.2"
    modules = [ 'javafx.controls', 'javafx.fxml' ]
}

mainClassName = "helloFx.MainApp"

eclipse {
    classpath {
        file {
            whenMerged {
                entries.findAll { it.properties.kind.equals('lib') }.each {
                    it.entryAttributes['module'] = 'true'
                }
            }
        }
    }
}

jlink {
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        name = 'helloFx'
    }
}

 

11. right-mouse click -> Gradle -> Refresh Gradle Project


12. you can look  'Project and External Dependencies' -> javafx files..

 

 

13. src/main/java/helloFx > Library.java delete > MainApp.java Modify

package helloFx;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MainApp extends Application {

    @Override
    public void start(Stage stage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
        
        Scene scene = new Scene(root);
        
        stage.setTitle("JavaFX and Gradle");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }

}

 

 

14. src/main/java right-mouse click -> New -> Class

   1) Package : (empty)

   2) Name : module

   And Finish

   

 

 

15. src/main/java right-mouse click ->Properties

 

 

16. Resource -> Location icon Click

 

17. src/main/java/module.java -> Replace Name -> Module-info.java -> F5 Refresh

 

 

18. module-info.java modify

module helloFx {
    requires javafx.controls;
    requires javafx.fxml;
    requires transitive javafx.graphics;
    
    opens helloFx to javafx.fxml;
    exports helloFx;
}

 

 

19. src/main/resources -> create package : helloFx -> helloFx right-mouse click -> new -> new FXML Document

 

 

20. name : scene -> finish

 

21. gradlew.bat -> right-mouse click -> Resource -> Location icon click

 

 

22. right-mouse click -> open PowerShell

 

23. gradlew run

/\gradlew run

 

반응형