Some minor adjustments that localize the problem of GUI in fxlm file itself (root not correctly set?) I moved the fxml file to a spot, where gradle expects it

This commit is contained in:
Seraina
2022-04-16 23:28:52 +02:00
parent 88f72d7612
commit 8e12e6e662
4 changed files with 94 additions and 13 deletions

View File

@@ -1,21 +1,21 @@
package ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.chat;
import ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.ClientModel;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Objects;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
public class ChatApp extends Application {
ClientModel clientModel;
private ChatController chatController;
public ChatApp() {
super();
}
public ChatApp(ClientModel clientModel) {
this.clientModel = clientModel;
this.chatController = new ChatController(clientModel);
@@ -36,14 +36,25 @@ public class ChatApp extends Application {
*/
@Override
public void start(Stage primaryStage) throws Exception {
URL resource = ChatApp.class.getResource(
"splitPaneChatView.fxml");
if (resource == null) {
System.out.println("File wasnt found");
}
//ChatApp chatApp = new ChatApp(new ClientModel());
Parent root = FXMLLoader.load(getClass().getResource("splitPaneChatView.fxml"));
// TODO bin chatController.getChatPaneRoot() border to root border for rezising
Scene scene = new Scene(root);
try {
Parent root = FXMLLoader.load(
Objects.requireNonNull(ChatApp.class.getResource(
"splitPaneChatView.fxml")));
// TODO bin chatController.getChatPaneRoot() border to root border for rezising
Scene scene = new Scene(root);
scene.setRoot(root);
primaryStage.setScene(scene);
} catch (Exception e) {
e.printStackTrace();
}
primaryStage.setResizable(true);
primaryStage.setTitle("Chat");
primaryStage.setScene(scene);
primaryStage.show();

View File

@@ -51,7 +51,9 @@ public class ChatController implements Initializable {
private static final String chatToAll = Protocol.chatMsgToAll;
private static final String chatToLobby = Protocol.chatMsgToLobby;
public ChatController() {
super();
}
public ChatController(ClientModel client) {
this.client = client;
whisperTargetChosen = new SimpleBooleanProperty();