Testing JavaFX stuff
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'application'
|
id 'application'
|
||||||
|
id 'org.openjfx.javafxplugin' version '0.0.8'
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'de.siphalor'
|
group 'de.siphalor'
|
||||||
@@ -19,6 +20,11 @@ dependencies {
|
|||||||
testImplementation('org.junit.jupiter:junit-jupiter:5.6.2')
|
testImplementation('org.junit.jupiter:junit-jupiter:5.6.2')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
javafx {
|
||||||
|
version '14'
|
||||||
|
modules = [ "javafx.controls", "javafx.graphics", "javafx.fxml" ]
|
||||||
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
testLogging {
|
testLogging {
|
||||||
@@ -45,3 +51,4 @@ jar {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class WhatAStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
visual.start(this);
|
visual.setup(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class CanvasVisual implements Visual {
|
|||||||
private boolean fullScreen = false;
|
private boolean fullScreen = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(WhatAStorage whatAStorage) {
|
public void setup(WhatAStorage whatAStorage) {
|
||||||
main = whatAStorage;
|
main = whatAStorage;
|
||||||
frame.addWindowListener(new WindowAdapter() {
|
frame.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
29
src/main/java/de/siphalor/was/visual/JFXVisual.java
Normal file
29
src/main/java/de/siphalor/was/visual/JFXVisual.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package de.siphalor.was.visual;
|
||||||
|
|
||||||
|
import de.siphalor.was.WhatAStorage;
|
||||||
|
import de.siphalor.was.assets.AssetsManager;
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class JFXVisual extends Application implements Visual {
|
||||||
|
private Scene mainScene;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup(WhatAStorage whatAStorage) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
launch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
FXMLLoader loader = new FXMLLoader();
|
||||||
|
|
||||||
|
HBox hb = loader.load(AssetsManager.getResource("jfx/main.fxml"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,6 @@ package de.siphalor.was.visual;
|
|||||||
import de.siphalor.was.WhatAStorage;
|
import de.siphalor.was.WhatAStorage;
|
||||||
|
|
||||||
public interface Visual {
|
public interface Visual {
|
||||||
void start(WhatAStorage whatAStorage);
|
void setup(WhatAStorage whatAStorage);
|
||||||
void run();
|
void run();
|
||||||
}
|
}
|
||||||
|
|||||||
9
src/main/resources/assets/jfx/main.fxml
Normal file
9
src/main/resources/assets/jfx/main.fxml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
|
||||||
|
<VBox>
|
||||||
|
<children>
|
||||||
|
<Label text="Hello world FXML"/>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
Reference in New Issue
Block a user