Skip to content
Snippets Groups Projects

refactor: set javafx components in tables

Merged Carl Gützkow requested to merge refactor/controller-tables into master
2 files
+ 32
30
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -3,6 +3,9 @@ package edu.ntnu.idatt2001.carljgu.client;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors;
import edu.ntnu.idatt2001.carljgu.client.dialogs.DialogBoxBuilder;
import javafx.application.Application;
@@ -19,7 +22,7 @@ import static javafx.scene.control.Alert.AlertType.ERROR;
* Responsibility for creating the stage.
*
* @author Carl Gützkow
* @version 1.1 27.03.2022
* @version 1.2 6.05.2022
*/
public class App extends Application {
@@ -34,14 +37,14 @@ public class App extends Application {
@Override
public void start(Stage startStage) {
stage = startStage;
Scene scene = null;
stage.setTitle("Wargames");
stage.setMaximized(true);
try {
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getClassLoader().getResource("wargames.fxml"));
scene = new Scene(fxmlLoader.load(), 1300, 740);
Scene scene = new Scene(fxmlLoader.load(), 1300, 740);
scene.getStylesheets().add("stylesheet.css");
stage.setTitle("Wargames");
Path currentPath = Paths.get("").toAbsolutePath();
Path imagePath = Paths.get(currentPath.toString(), "src","main","resources","icons","wargames-logo.png");
Image icon = new Image(imagePath.toString());
@@ -51,7 +54,12 @@ public class App extends Application {
stage.show();
} catch (IOException | IllegalStateException e) {
new DialogBoxBuilder(ERROR)
.addHeader("Program could not be started. File was not found.")
.addHeader("Program could not be started. Expand the \"Show details\" button to see full stack trace.")
.addListMessage(
Arrays.stream(e.getStackTrace())
.map(String::valueOf)
.collect(Collectors.toCollection(ArrayList::new)
))
.build().showAndWait();
}
Loading