Compare commits

..

3 Commits

Author SHA1 Message Date
Jonathan Turner
3b56a1fb50 Added RichTextFX (May be removed later. 2024-02-11 01:45:37 -05:00
Jonathan Turner
2714b23dab Added base start for javafx setup. 2024-02-11 01:39:33 -05:00
Jonathan Turner
53d046858f Added JavaFX Dependencies and resource mapping for seperation of concerns. 2024-02-11 01:39:16 -05:00
11 changed files with 81 additions and 21 deletions

View File

@ -6,6 +6,11 @@
<option name="name" value="Central Repository" /> <option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" /> <option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="snapshots" />
<option name="name" value="Sonatype Snapshots" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
</remote-repository>
<remote-repository> <remote-repository>
<option name="id" value="central" /> <option name="id" value="central" />
<option name="name" value="Maven Central repository" /> <option name="name" value="Maven Central repository" />

35
pom.xml
View File

@ -13,5 +13,38 @@
<maven.compiler.target>19</maven.compiler.target> <maven.compiler.target>19</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencies>
<dependency>
<groupId>org.fxmisc.richtext</groupId>
<artifactId>richtextfx</artifactId>
<version>0.11.0</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>12.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>20.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>edu.jturn.cs3642.CS3642-Artificial_Intelligence/Assignments.A1.GUIDriver</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -14,6 +14,8 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.PriorityQueue; import java.util.PriorityQueue;
@ -122,32 +124,17 @@ public class Driver {
} }
private static void writeToFile(String name, StringBuffer values) { private static void writeToFile(String name, StringBuffer values) {
File directory = new File("src/Assignments/A1/results"); URL resourcePath = Driver.class.getResource("/A1/results/AStar.txt");
if (!directory.exists()) { URI resourceURI = URI.create(resourcePath.toString());
directory.mkdirs(); File resource = new File(resourceURI.getPath());
System.out.println("Creating Directory: results");
}
File output = new File(directory, name + ".txt"); try (FileWriter out = new FileWriter(resource)) {
try {
if (!output.createNewFile()) {
System.out.println("File Already Exists: " + name + ".txt");
} else {
System.out.println("File Created: " + name + ".txt");
}
} catch (IOException e) {
System.err.println("Error creating file: " + e.getMessage());
}
try (FileWriter out = new FileWriter(output)) {
out.write(values.toString()); out.write(values.toString());
System.out.println("Data written to file: " + name + ".txt"); System.out.println("Data written to file: " + name + ".txt");
} catch (IOException e) { } catch (IOException e) {
System.err.println("Error writing to file: " + e.getMessage()); System.err.println("Error writing to file: " + e.getMessage());
} }
openDirectoryFile(resource);
openDirectoryFile(output);
} }
private static void openDirectoryFile(File open) { private static void openDirectoryFile(File open) {

View File

@ -0,0 +1,26 @@
package Assignments.A1;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class GUIDriver extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("/A1/view/BoardView.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("A1/view/styles.css").toExternalForm());
stage.setTitle("JavaFX and Maven");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}

View File

@ -0,0 +1,9 @@
package Assignments.A1;
public class GUILauncher {
public static void main(final String[] args) {
GUIDriver.main(args);
}
}

View File

View File

View File

View File

View File