Updated sharedcodecontroller

Shared code compiler now runs to show main screen, if it didn't already.
This commit is contained in:
law39 2020-04-25 22:08:43 +01:00
parent 530d038c33
commit 08a4f5e4bc
10 changed files with 44 additions and 19 deletions

View file

@ -1,28 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.top19</groupId>
<artifactId>sharedcontroller</artifactId>
<groupId>uk.ac.aber.cs22120.group20</groupId>
<artifactId>Welsh Vocabulary Tutor</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>13</javafx.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx</artifactId>
<version>13</version>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>13</version>
<version>11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.1</version>
<configuration>
<mainClass>uk.ac.aber.cs22120.group20.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,9 +1,13 @@
package code;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.util.Objects;
public class Application extends javafx.application.Application {
private static Scene scene;
public static void main(String[] args) {
@ -12,7 +16,7 @@ public class Application extends javafx.application.Application {
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("test.fxml"));
Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getClassLoader().getResource("test.fxml")));
primaryStage.setTitle("test");
primaryStage.setScene(new Scene(root,300, 275));

View file

@ -1,3 +1,5 @@
package code;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.image.Image;

View file

@ -1,4 +1,7 @@
module sharedcontroller {
requires javafx.graphics;
module code {
requires javafx.controls;
requires javafx.fxml;
opens code to javafx.fxml;
exports code;
}

View file

@ -12,7 +12,7 @@
<?import javafx.scene.text.Font?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="SharedCodeController"
fx:controller="code.SharedCodeController"
prefHeight="400.0" prefWidth="600.0">
<left>

View file

@ -12,7 +12,7 @@
<?import javafx.scene.text.Font?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="SharedCodeController"
fx:controller="code.SharedCodeController"
prefHeight="400.0" prefWidth="600.0">
<left>