Compare commits

...

1 Commits

Author SHA1 Message Date
11d5281a20 Add JavaFX 2021-11-03 23:35:29 +01:00
8 changed files with 65 additions and 6 deletions

2
.idea/.name generated
View File

@ -1 +1 @@
ultimate-tictactoe
UltimateTicTacToe

18
.idea/runConfigurations/Run_JavaFX.xml generated Normal file
View 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>

View File

@ -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.*" />

View File

@ -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{

View File

@ -1,2 +1,2 @@
rootProject.name = 'ultimate-tictactoe'
rootProject.name = 'UltimateTicTacToe'

View File

@ -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) {
SwingUtilities.invokeLater(MainWindowView::new);
if (System.getenv().containsKey("jfx")) {
Application.launch(MainFX.class, args);
} else {
SwingUtilities.invokeLater(MainWindowView::new);
}
}
}

View 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();
}
}

View File

@ -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;
}