Add JavaFX
This commit is contained in:
parent
2294c95517
commit
11d5281a20
@ -1 +1 @@
|
||||
ultimate-tictactoe
|
||||
UltimateTicTacToe
|
18
.idea/runConfigurations/Run_JavaFX.xml
Normal file
18
.idea/runConfigurations/Run_JavaFX.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run JavaFX" type="Application" factoryName="Application">
|
||||
<envs>
|
||||
<env name="jfx" value="true" />
|
||||
</envs>
|
||||
<option name="MAIN_CLASS_NAME" value="de.icaotix.ultimatetictactoe.Main" />
|
||||
<module name="UltimateTicTacToe.main" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="de.icaotix.ultimatetictactoe.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@ -1,7 +1,7 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run" type="Application" factoryName="Application">
|
||||
<configuration default="false" name="Run Swing" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="de.icaotix.ultimatetictactoe.Main" />
|
||||
<module name="ultimate-tictactoe.main" />
|
||||
<module name="UltimateTicTacToe.main" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="de.icaotix.ultimatetictactoe.*" />
|
@ -1,6 +1,8 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'application'
|
||||
id 'org.beryx.jlink' version '2.24.4'
|
||||
id 'org.openjfx.javafxplugin' version '0.0.10'
|
||||
}
|
||||
|
||||
group 'de.icaotix.ultimatetictactoe'
|
||||
@ -15,6 +17,13 @@ dependencies {
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
|
||||
}
|
||||
|
||||
javafx {
|
||||
version = "17"
|
||||
modules = [ 'javafx.controls', "javafx.fxml" ]
|
||||
}
|
||||
|
||||
mainClassName = "$moduleName/de.icaotix.ultimatetictactoe.Main"
|
||||
|
||||
jlink {
|
||||
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
|
||||
launcher{
|
||||
|
@ -1,2 +1,2 @@
|
||||
rootProject.name = 'ultimate-tictactoe'
|
||||
rootProject.name = 'UltimateTicTacToe'
|
||||
|
||||
|
@ -1,12 +1,18 @@
|
||||
package de.icaotix.ultimatetictactoe;
|
||||
|
||||
import de.icaotix.ultimatetictactoe.view.MainWindowView;
|
||||
import javafx.application.Application;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (System.getenv().containsKey("jfx")) {
|
||||
Application.launch(MainFX.class, args);
|
||||
} else {
|
||||
SwingUtilities.invokeLater(MainWindowView::new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
21
src/main/java/de/icaotix/ultimatetictactoe/MainFX.java
Normal file
21
src/main/java/de/icaotix/ultimatetictactoe/MainFX.java
Normal file
@ -0,0 +1,21 @@
|
||||
package de.icaotix.ultimatetictactoe;
|
||||
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class MainFX extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
String javaVersion = System.getProperty("java.version");
|
||||
String javafxVersion = System.getProperty("javafx.version");
|
||||
Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
|
||||
Scene scene = new Scene(new StackPane(l), 640, 480);
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
}
|
@ -1,3 +1,8 @@
|
||||
module ultimate.tictactoe.main {
|
||||
module UltimateTicTacToe {
|
||||
requires java.desktop;
|
||||
requires javafx.controls;
|
||||
|
||||
opens de.icaotix.ultimatetictactoe to javafx.graphics;
|
||||
|
||||
exports de.icaotix.ultimatetictactoe;
|
||||
}
|
Loading…
Reference in New Issue
Block a user