[javaFX] Getting Started Modular with Gradle Tutorial (Eclipse)
Programming/javaFX 2021. 3. 2. 13:26- maven non-modular
- gradle non-modular
- maven modular
- gradle modular <-
*** First. java 11 or higher download and install here
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
'Programming > javaFX' 카테고리의 다른 글
[JavaFX] get Controller (0) | 2021.12.05 |
---|---|
[javaFX] JavaFX 17 IntelliJ IDEA 튜토리얼 With Gradle (0) | 2021.10.20 |
[javaFX] CellSpanTableView for javaFX 11 (0) | 2021.02.26 |
[javaFX] CSS Reference Guid (0) | 2021.02.24 |
[javaFX] JAXB (Java Architecture for XML Binding) - java 11 (0) | 2021.02.20 |